XDoc.PDF
Features
Tech Specs
How-to C#
How-to VB.NET
Pricing
SDK User Guide Conversion File and Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print Work with Other SDKs Barcode Read Barcode Create
Convert MS Word, Excel, or PowerPoint to PDF
  |  
Home ›› XDoc.PDF ›› C# PDF: MS Office to PDF

How to C#: Convert Word, Excel and PPT to PDF


Online C# Tutorial for Converting MS Office Word, Excel and PowerPoint to PDF



Look for HTML5 PDF Editor?

EdgePDF: ASP.NET PDF Editor is the best HTML5 PDF Editor and ASP.NET PDF Viewer based on XDoc.PDF, JQuery, HTML5. It supports ASP.NET MVC and WebForms projects.


MS Office to PDF Conversion Overview



By integrating XDoc.PDF SDK into your C#.NET project, Microsoft Office like Word, Excel, and PowerPoint can be converted to PDF document. Generally speaking, following conversion types are supported.


From MS-DOC and MS-DOCX to PDF


From MS-XLS and MS-XLSX to PDF


From MS-PPT and MS-PPTX to PDF



How to C#: Convert Word to PDF



Following is C# demo code for Word (.docx) to PDF conversion.




String inputFilePath = Program.RootPath + "\\" + "1.docx";
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";

// Load a Word (.docx) document.
DOCXDocument doc = new DOCXDocument(inputFilePath);

// Convert it to PDF document.
doc.ConvertToDocument(DocumentType.PDF, outputFilePath);





How to C#: Convert Excel to PDF



This is a C# class example for Excel (.xlsx) to PDF conversion.




String inputFilePath = Program.RootPath + "\\" + "1.xlsx";
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";

// Load an Excel (.xlsx) file.
XLSXDocument doc = new XLSXDocument(inputFilePath);

// Convert Excel to PDF.
doc.ConvertToDocument(DocumentType.PDF, outputFilePath);





How to C#: Convert PPT to PDF



Following sample code may help you with converting PowerPoint to PDF file.




String inputFilePath = Program.RootPath + "\\" + "1.pptx";
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";

// Load a PowerPoint (.pptx) file.
PPTXDocument doc = new PPTXDocument(inputFilePath);

// Convert it to a PDF.
doc.ConvertToDocument(DocumentType.PDF, outputFilePath);