Some test text!

Convert Documents to PDF

In this document
chevron_rightThe ToPdf() Method
chevron_rightMS Office Document Conversion
chevron_rightWorking with a Windows Service
chevron_rightWorking with an ASP.NET Application

linkThe ToPdf() Method

The pdftron.PDF.Convert.ToPdf() (ToPdf for short) method (or, relatedly, ToXod or ToXps), converts multiple file formats to the requested file output format. It supports several input formats like docx, xlsx, rtf, txt, html, pub, etc. In order to convert these file formats the ToPdf method uses the PDFNet printer to request a print job, and the print output (in XPS) will be used for the actual conversion process.

It is important to keep in mind that in order to use the PDFNet printer, there must be an application installed on the machine, which will send print jobs to the PDFNet printer. The PDFNet printer works like any other printer; in order to print a document, an application must send printing jobs to the printer first, the PDFNet printer cannot open documents by itself.

For example: Printing a text file requires a text file viewer to perform a printing task. In Windows, this is normally notepad.exe.

ToPdf automates this process. It issues the print command on a document, and expects that an installed application will process the command. If the application does not support printing of the opened document, then the Convert.ToPdf method will fail.

Note: It is important to understand that in a 64-bit operating system, the 64-bit PDFNet printer driver must be installed. Installing the 32-bit PDFNet printer in a 64-bit operating system will not work. To install the 64-bit PDFNet printer driver, use the 64-bit version of PDFNet.dll and invoke the following method in a .NET application:

if (!pdftron.PDF.Convert.Printer.IsInstalled())

linkMS Office Document Conversion

If Microsoft Office 2007 SP2 or later is installed, ToPdf method will take advantage of Microsoft Office’s OLE interop automation library to convert Microsoft Office documents to PDF or XPS formats. Using Microsoft Office guarantees high quality PDF or XPS output files.

The PDFNet printer will not be used when a document can be converted using the available Microsoft Office’s interop libraries. However; the converter will use the PDFNet printer if an earlier version of Microsoft Office is installed - any versions prior to 2007 SP2. This is because the SaveAsPDFandXPS extension is not available in the older versions of Microsoft Office.

linkWorking with a Windows Service

linkWorking with an ASP.NET Application