Not able to see saved files inside azure storage container - crystal-reports

string filePath = #"C:\test.pdf";
CloudBlockBlob blockBlob = container.GetBlockBlobReference("DxRecordForm");
FileStream localDirDxRecordForm = File.Create(filePath);
localDirDxRecordForm.Close();
dxCodeReport.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, filePath);
using (var fileStream = System.IO.File.OpenRead(filePath))
{
blockBlob.UploadFromStream(fileStream);
}
I am exporting a crystal report into pdf format and then saving the pdf in azure storage container. In above code dxCodereport is an instance of crystal report. When I view my storage container, I see the block blob named DxRecordForm. When I click that, I am also able to see the pdf version of my crystal report.
I am not sure why I don't see the file Test.pdf inside my container. I just see the block blob with content-type application/octet-stream.

Your code snippet above uploads the file C:\test.pdf to a block blob named DxRecordForm. This would not result in creating a blob named test.pdf. If you would like to upload it a blob named test.pdf, please use "test.pdf" when getting a block blob reference.

Related

Azure Data Factory Passing a pipeline-processed file as a mail attachment with logic app

I have an ADF pipeline moving a file to a blob storage. I am trying to pass the processed file as a parameter of my web activity so that I can use it as an email attachment. I am successfully passing the following parameters:
{
"Title":"Error File Received From MOE",
"Message": "This is a test message.",
"DataFactoryName":"#{pipeline().DataFactory}",
"PipelineName":"#{pipeline().Pipeline}",
"PipelineRunId":"#{pipeline().RunId}",
"Time":"#{utcnow()}",
"File":????????????????????????????
}
But, how should I specify the path to the file I just processed within the same pipeline?
Any help would be greatly appreciated,
Thanks
Eric
I'm copying data to output container. My current assumption is to upload a file a day, and then use two GetMetadata activities to get the lastModified attribute of the file to filter out the name of the most recently uploaded file.
Get Child items in Get Metadata1 activity.
Then in Foreach activity, get child items via dynamic content #activity('Get Metadata1').output.childItems
Inside Foreach activity, in Get Metadata2 activity, specify the json4 dataset to the output container.
Enter dynamic content #item().name to foreach the filename list.
In If condition activity, using #equals(dayOfMonth(activity('Get Metadata2').output.lastModified),dayOfMonth(utcnow())) to determine whether the date the file was uploaded is today.
In true activity, add dynamic content #concat('https://{account}.blob.core.windows.net/{Path}/',item().name) to assign the value to the variable.
The output is as follows:

Open a file from crystal report export to stream function

How can i open a file directly from stream which is exported through crystal report export to stream function? I am using vs2010 and sap crystal report.
MemoryStream m = (MemoryStream)(PReport.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat));
FileStream f = new FileStream(purchaseCombo.SelectedItem.ToString(),FileMode.Create,System.IO.FileAccess.Write);
byte[] bytes = new byte[m.Length];
m.Read(bytes, 0, (int)m.Length);
f.Write(bytes, 0, bytes.Length);
f.Close();
m.Close();
It depends on the file that you are exporting. Since Crystal Reports can export a number of different file types and each of them has a specific program that can handle it, you will need to search for the exact file type that you're interested. For example with a quick search on the internet, I found that a stream of an html file can be directly previewed inside a WebBrowser component (in a WPF app) by using the NavigateToStream method. Maybe there are some 3rd party components that expose methods for directly opening files from memory.
Though, the easiest way would be to export a temporary file to disk instead of memory by using the ExportToDisk method and delete it after its usage, since many components read from paths rather than memory. Before exporting the file, you can use the GetTempFileName method which creates and names a temporary file.

C# Generated PDF File Does not save

I have created a pdf file using c# code and now i want to save created pdf file into my local machine drive "E" but an error shown to me that "Access to the path 'E:\My Projects' is denied."...
here is the code to save pdf file
FileStream fileStream = new FileStream(#"E:\My Projects", FileMode.OpenOrCreate,
FileAccess.ReadWrite, FileShare.None);
Any one please help me out....
Assuming you have
path a string with the full qualified name and
pdf a byte[] of the generated pdf,
then just do:
File.WriteAllBytes(path, pdf);
See http://msdn.microsoft.com/en-us/library/system.io.file.writeallbytes.aspx

PDF file stored as BLOB, view in a webpage perl

I have a code that handles displaying a blob from a local Oracle database. I store both JPG and PDF files as blob. I could view the JPG file, but not the PDF. I have checked these
$self->content_type('image/jpg')
to
$self->content_type('application/pdf').
And the Blob does have data. I checked the length and it has "184546".
All I get when I click the link for the pdf file is a blank page with the title GETIMAGPAGE(application/pdf).
Any help or pointers would be greatly appreciated.
Also, How can we have the content_type to enable two different mime_types? For example in my case both image as well as pdf, depending on what we get?
File::MMagic can recognize the type of data using magic numbers.
use File::MMagic;
$magic = File::MMagic->new;
$self->content($blob);
$self->content_type($magic->checktype_contents($blob));
If you don't want to require a native/plugin PDF reader, perhaps FlexPaper might fit your needs.

CrystalReportSource binding

Hello I have a crystalReportViewer and CrystalReportSource on a web form.
I need to be able to bind the reportSource at run time to different report files.
I have the file data stored in a blob in a DB.
The mechanism I am using now is to save the blob to a file and then
this.CrystalReportSource1.Report.FileName = myFileName;
The issue is that I want to avoid saving the file on disk and somehow bind the report directly to a file stream.
Is that possible?
Thanks
In C#, I believe that you should be able to use something like the following, but I haven't tested it out on my system.
ReportDocument rpt = new ReportDocument();
rpt.Load(filestream); //filestream is your filestream object
Give it a try and let me know if you have issues.