Free Support Forum -

Excel to PDF In memory

I have an application that I am currently building reports dynamically and exporting to the browser and now need the ability to export as PDF. My thinking is, that since I already have the structure to build these as Excel files, that I build them just the same then convert to PDF is the user prefers that format. How do I go about doing this with Aspose?


Please see the document for your complete reference on how to save to streams or disk for different file formats including PDF:

Sample code segments:

i) Save to PDF stream directly.
workbook.Save(stream, SaveFormat.Pdf)

ii) Export to PDF using Response object
//… Your code goes here

//Save in pdf format and send the file to the client browser, he may open the file in
//some application or save it to some location
workbook.Save(this.Response, “Report.pdf”, ContentDisposition.Attachment, new PdfSaveOptions());
 Let us know if you have any confusion or query.
Thank you.

Unfortunately, this is not working. I am not creating the Excel files dynamically with Aspose nor do I have a physical file that I am starting with. I am creating the Excel files dynamically with another product and, unfortunately cannot rewrite all of the code at this time to convert to utilize Aspose.Cells. My long term solution would be to take this approach but for now I need to to take the stream or the Excel file in memory (which I already have) and convert to a PDF and export to the browser.

Ok, I got this working. I was trying to do this with Aspose.PDF instead of Aspose.Cells. Thanks.


Good to know that you have sorted it out now.

Feel free to contact us any time if you have further query or issue, we will be happy to assist you here.

Thank you.