ImageGear .NET provides the ability to convert any Microsoft Office Open XML and Microsoft Office 97-2003 document currently supported by the product or any page of a Microsoft Office Open XML or Microsoft Office 97-2003 document and save the converted content to a PDF file. This can be done by using one of the following API calls:
ImageGear .NET Office to PDF converter provides the conversion of all currently supported text elements, raster images, and graphic shapes for Microsoft Office Open XML and Microsoft Office 97-2003 formats described in Using ImageGear.Formats.Office Namespace.
Note the following conversions that take place when converting to PDF:
This sample shows how to input a Word document in the DOCX/DOC format and output all pages as a PDF document.
After some initializations, load the necessary ImGear filters to create an instance of Microsoft Word format for input and an instance of PDF format for output using code that looks like:
Next, the PDF library requires its own initialization:
Then, simply read in all pages of the Word document using the ImGearFileFormats.LoadDocument() method:
Finally, write out the document as PDF using the ImGearFileFormats.SaveDocument() method with the saving format set to ImGearSavingFormats.PDF and no special options:
This sample can be easily adjusted to accept Excel Spreadsheet XLSX/XLS documents as input.
To accept XLSX/XLS files as input, create an instance of Microsoft Excel format after initializing ImageGear .NET:
and modify the sample's open file dialog to accept the *.xlsx/*.xls extensions:
This sample can be easily adjusted to accept PowerPoint PPTX/PPT files as input.
To accept PPTX files as input, create an instance of Microsoft PowerPoint format after initializing ImageGear .NET:
and modify the sample's open file dialog to accept the *.pptx extension: