Convert Binary Stream to PDF using .net

Hi,

I need help in converting binary stream to PDF. Please provide a solution for my requirement.

Thanks.

Hi Jinu,

Thanks for your inquiry. You can read binary data into memory stream and use Document class constructor with stream parameter for the purpose. Please check the following code snippet, hopefully it will help you to accomplish your requirements. If there is some difference in your requirements and my understanding then please share some more details, so we will look into it and will provide you more information.

HtmlLoadOptions options = new HtmlLoadOptions(); // use the new conversion engine
options.UseNewConversionEngine = true;

FileStream fs = new FileStream(myDir + "Input.html", FileMode.Open, FileAccess.Read);
byte[] tmpBytes = new byte[fs.Length];
fs.Read(tmpBytes, 0, Convert.ToInt32(fs.Length));
MemoryStream mystream = new MemoryStream(tmpBytes);

// load HTML file
Document pdfDocument = new Document(mystream, options);
pdfDocument.PageInfo.IsLandscape = true;

// save output as PDF format
pdfDocument.Save(myDir + "HTMLtoPDF_DOM.pdf");

Please feel free to contact us for any further assistance.

Best Regards,