We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Saving an IWorkBook to a PDFDocument

Thread ID:





52897 Dec 5,2006 08:59 PM UTC Dec 12,2006 12:27 AM UTC WinForms 6
Tags: XlsIO
Shannon Broskie
Asked On December 5, 2006 08:59 PM UTC

I just installed v4.4 hoping to use the new save XLS to PDF functionality.

I getting an error when trying to create the PDFDocument object. It tells me I have invalid/unknown/unsupported PDF format. I've been trying to piece together bits from other posts and have not found anything on the final method to do this. I realize that the PDFDocument class constructor is probably looking for a stream with pdf content already in it but I am having a hard time even finding the OpenXML method shown in other posts.


MemoryStream stream = new MemoryStream();
workbook.SaveAsXml(stream, ExcelXmlSaveType.DLS);
PDFDocument pdfDoc = new PDFDocument(stream);

Chella Pandian B [Syncfusion]
Replied On December 5, 2006 10:52 PM UTC

Hi Shannon Broskie,

I have created a sample for saving a excel sheet to a PDF. Please check the sample and let me know if you have any other difficulties.


Thank for your interest in XlsIO.

With regards,

Shannon Broskie
Replied On December 6, 2006 01:45 PM UTC

Thanks for the sample. I have a couple of questions about the sample.

According to the code, 'Hello World' should have shown up in the PDF. If I run the code, a blank PDF document is created.

Secondly, I modified the code to save to a MemoryStream instead of a file. One note there is that after saving the workbook to a stream, you need to set the Position of the stream back to 0 or you will get a root element not found error. Even using a stream though, I'm not getting the 'Hello World' text. The XML output does indead contain the 'Hello World' text though.

Any thoughts on what I might try to get the PDF generation working?

I'm running VS2005.

Thanks again.

Chella Pandian B [Syncfusion]
Replied On December 6, 2006 07:52 PM UTC

Hi Shannon Broskie,

I am afraid that I was unable to reproduce your problem.

1. The sample shows the pdf file with “Hello world”.

2. I have modified the sample as per your requirement. This samples creates a memory stream object and converts that stream into a xml file and then save it to pdf.

Please check the new sample, which converts memory stream to PDF and Let me know if you have any other difficulties.



Sorry for the inconvenience.
Thanks for using XlsIO.

Best regards,

Shannon Broskie
Replied On December 8, 2006 03:15 PM UTC

Thanks again for your post. I've attached a recording of me opening up your solution along with the results. The only thing I have to change is the references to Syncfusion.DLS.Base and Syncfusion.Pdf.Base as they were pointing to version and I'm running the latest

Let me know what you think. Hope you enjoy the movie.


Chella Pandian B [Syncfusion]
Replied On December 8, 2006 11:36 PM UTC

Hi Shannon Broskie ,

I seriously regret for the previous sample. I was able to reproduce the issue. I will take this issue with high priority and discuss this with my team and get back to with in 2 days.

We are extremely sorry for the inconvenience.

With regards,

Chella Pandian B [Syncfusion]
Replied On December 12, 2006 12:27 AM UTC

Hi Shannon,

I regret for the delay in getting back to you. I have created a bug report regarding this issue. Please check this following link for further updates. Please let us know if you have any other difficulties in using XlsIO.

Open issue link:

Thank you for your interest in Syncfusion Essential XlsIO.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon