Some test text!
To convert of different file types to PDF Documents acting as a virtual printer.
# Start with a PDFDoc (the conversion destination) doc = PDFDoc.new() # perform the conversion with no optional parameters Convert.ToPDF(doc, filename)
PDF Converter (SVG, XPS, TIFF, JPG, RTF, TXT, More)
Full sample code which shows how to convert any printable document (e.g. Word, HTML, RTF, MS Office, DXF, DWG, etc) to PDF
pdftron.PDF.Convert.ToPdf method (
ToPdf for short, and relatedly,
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 !Convert::Printer::IsInstalled() Convert::Printer::Install() end
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.
Converting documents using PDFTron, inside a Windows service, or an ASP.NET application requires some changes to the default settings that are used. Please read further to understand this better.
Get the answers you need: Support
Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.
Select a platform to get started with your free trial.
Unlimited usage. No email address required.
PDFTron Receives USD$71 Million Growth Investment Led By Silversmith Capital PartnersLearn more