Excel to PDF

Hi,
I wanted to know if there is any way to convert Excel to PDF file.
I have 7.2.0.37 Version. If not then whats the best way to achieve it.

Thanks!

3 Replies

VN Vijesh Narayanan Syncfusion Team August 13, 2009 07:25 AM UTC

Hi Ketal,

Thank you for using Essential XlsIO.

It is not directly possible to convert a Excel file to PDF, but a work around will be to first convert Excel file to image and then adding the image to pdf file.

Please follow the link below to find the sample application to convert Excel to PDF.

http://files.syncfusion.com//samples/XlsIO.Windows/F88813/F88813.zip

Please note that you are required to have Essential PDF installed on your system to run this application.


Please let me know if you have any further questions.

Regards,
Vijesh




KS Ketal Sheth August 13, 2009 08:47 PM UTC

Thanks for the reply. I was also thinking that way. But the issue I am running in to is that the size of image converted in pdf is not correct.

Instead of using RectangleF can we use anything else so that the image quality will be good in pdf file.

g.DrawImage(img, New RectangleF(10, 20, 500, 300))

Is there a way to set the dimensions in such a way that the size of pdf text and images may be somewhat close to the original excel file.

Thanks!


VN Vijesh Narayanan Syncfusion Team August 14, 2009 04:18 AM UTC

Hi Ketal,

You can try including the following code snippet into the application I sent.


doc.PageSettings.Margins.All = 0;
g.DrawImage(image, new RectangleF(10, 10,
page.Size.Width ,page.Size.Height));



You can also follow the link below to find PDF sample on Image insertion.

http://samples.syncfusion.com/ASPNET/7.3.0.20/web/Pdf.Web/samples/3.5/Graphics/InsertingImages/CS/default.aspx


Please try this and let me know if that helped.


Regards,
Vijesh

Loader.
Up arrow icon