How to create pdf from byte array

Dear All,

byte[] bytes = Convert.FromBase64String(base64); // This can be from any file type (.txt, jpg, doc, pdf, xls)
File.WriteAllBytes(filename, bytes);

–> then how to convert it into .pdf

please help

thanks

Hi Winanjaya,

You can use Aspose.Words to convert Word documents to PDF, Aspose.Cells to convert Excel documents to PDF. You can also use Aspose.Words to convert images to PDF. Document constructor in Aspose.Words and Workbook constructor in Aspose.Cells support loading files from stream so you can convert byte array to memory stream and then load and save as PDF.

Aspose.Words will be required to convert .txt, .jpg, .doc or any other Word files to PDF and Aspose.Cells will be required to convert .xls or any other Excel files to PDF. PDF files can be directly saved to disk without using Aspose APIs however if you want to convert a PDF to PDF/A etc. then Aspose.Pdf will be required for that purpose.

Best Regards,