Convert pdf file to blob c# - c#

I have a created a file in my service (E:\User\example.pdf) and I want to convert that to blob in my controller to download the file using axios in my front-end.
How to do that? Thanks

As previous stated, won't hurt to check more on BLOB : https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction
Here is how to UPLOAD FILE TO BLOB: https://learn.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-dotnet#upload-blobs-to-a-container

Related

Deflate gzip'ed blob when copying it to Azure file share

I have a SAS uri from a blob containing Content-Encoding set to gzip and Content-Disposition set to rename the downloaded file. This works fine when accessing the link through the browser. What I want to achieve however is copy the file over to an Azure File share (StartCopyAsync) using the said blob SAS uri. This works, but the end result on the file share isn't decompressed like when downloaded through the browser.
Any ideas how this can be achieved?
Copy operation will not automatically decompress the content for you. It will simply copy the raw data and properties from source blob to destination file.
If you want to have the decompressed content in file storage, you will have to write the code to do that. You would need to write the code to download the blob, decompress its contents and then upload the decompressed content in file storage.

Convert .h5 content to JSON from an IFormFile

I have an asp net core web application where I can upload files, and on the controller I get the files in IFormFile like this:
public IActionResult Create (AcquisitionDto <IFormFile> acquisitionDto)
Some of these files are images, but one is a .h5 with metadata. And I want to store this information in mongdb, so far so good.
But before writing to mongodb, I want to extract the information inside h5 so I can save it as fields in the mongo document.
In short, I want to open the .h5 file I get in controler as IFormFile and convert its content to JSON.
I am using HDF5DotNet.x64 package to try to open the file, but I can only open .h5 if I pass the file path but cannot open from a byte[] or MemoryStream.
Do you know any way or package to do this?
Thank you very much

how to read the content of PDF file which is opened in the browser

I have a requirement of reading the content of PDF file from browser using c# and then save it locally. There is no physical existence to that file. It is served when file code is provided using the query string. The sample url is like http://something/ReportStatus.aspx?indvl_pk=12334. I am getting no way to do that. Any help is appreciated. Thanks is advance.

How to save a pdf file in Http url in Asp.net C#

I will be generating one pdf file where i have a location like http://www.example.com/ContextName/DefaultFolder..
where i need to save files in Default folder could you please help in in this.

Displaying BLOB data in a Browser

I need to display my BLOB data directly into the IE Browser without saving a temporary file on the hard Disk.
I have successfully implemented the method of retrieving the file from the blob.
Please help me out or direct me to good articles on how to acheive this functionality.
Im using Visual Studio 2005, C#.NET and Oracle
You could do the following in an HTTP handler :
context.Response.ContentType = "multipart/related"; // I think...
context.Response.Write(<blob data here>);
Now this relies on a browser - IE, firefox - that can handle mht files..
If you want to parse the mht file and return html etc.. that would be a whole different scenario!
If you've already code that saves it as a file then all you need to do is to change that to write it to the Response.OutputStream stream instead of the file stream.

Categories

Resources