How do I programatically convert MS Office (Word and Excel) to PDF?

40 views
Skip to first unread message

Support

unread,
Aug 31, 2009, 8:09:11 PM8/31/09
to PDFTron PDFNet SDK
Q: I am looking for a way to programatically convert MS Office
documents (Word and Excel) to PDF. Is this supported anywhere in the
PDFNet or DotNet Framework? I am using PDFNet SDK (http://
www.pdftron.com/pdfnet) for PDF rendering and file processing, but I
need first to generate PDF from Office.

----------
A: You could use Office 2007 PDF/XPS Export Add-on to convert Office
documents (Word, Excel, etc) to PDF or XPS (http://www.microsoft.com/
downloads/details.aspx?FamilyID=4d951911-3e7e-4ae6-b059-
a2e79ed87041).

The code should be fairly short. For example:

Microsoft.Office.Interop.Excel.Workbook.ExportAsFixedFormat
( Excel.XlFixedFormatType.xlTypePDF, pdfpath,
Excel.XlFixedFormatQuality.xlQualityStandard, true, true, fpage,
tpage, false, oMissing);

For details, please see the following article
http://msdn.microsoft.com/en-us/library/bb407651.aspx.
Reply all
Reply to author
Forward
0 new messages