![]() |
#include <Convert.h>
Classes | |
class | Printer |
Convert::Printer is a utility class to install the a printer for print-based conversion of documents for Convert::ToPdf. More... | |
Static Public Member Functions | |
static void | FromXps (PDFDoc &in_pdfdoc, const UString &in_filename) |
Convert the specified XPS document to PDF and append converted pages to to the specified PDF document. | |
static void | FromEmf (PDFDoc &in_pdfdoc, const UString &in_filename) |
Convert the specified EMF to PDF and append converted pages to to the specified PDF document. | |
static void | ToEmf (PDFDoc &in_pdfdoc, const UString &in_filename) |
Convert the PDFDoc to EMF and save to the specified path. | |
static void | ToEmf (Page &in_page, const UString &in_filename) |
Convert the Page to EMF and save to the specified path. | |
static void | ToSvg (PDFDoc &in_pdfdoc, const UString &in_filename) |
Convert the PDFDoc to SVG and save to the specified path. | |
static void | ToSvg (Page &in_page, const UString &in_filename) |
Convert the Page to SVG and save to the specified path. | |
static void | ToXps (PDFDoc &in_pdfdoc, const UString &in_filename) |
Convert the PDFDoc to XPS and save to the specified path. | |
static void | ToXps (const UString &in_inputFilename, const UString &in_outputFilename) |
Convert the input file to XPS format and save to the specified path. | |
static void | ToPdf (PDFDoc &in_pdfdoc, const UString &in_filename) |
Convert the file or document to PDF and append to the specified PDF document. | |
static bool | RequiresPrinter (const UString &in_filename) |
Utility function to determine if ToPdf or ToXps will require the PDFNet printer to convert a specific external file to PDF. |
Conversion of XPS, EMF and image files to PDF documents is performed internally. Other document formats are converted via native application and printing.
using namespace pdftron; using namespace PDF; PDFDoc pdfdoc; Convert::FromXps(pdfdoc, input_path + "simple-xps.xps" ); Convert::FromEmf(pdfdoc, input_path + "simple-emf.emf" ); Convert::ToPdf(pdfdoc, input_path + test docx file.docx ); // Save the PDF document UString outputFile = output_path + "ConverterTest.pdf"; pdfdoc.Save(outputFile, SDF::SDFDoc::e_remove_unused, NULL);
The PDFTron PDFNet printer needs to be installed to convert document formats. On Windows installation of printer drivers requires administrator UAC, manifests have been added to the Convert samples (C++, C# and Visual Basic).
To install the printer the process must be running as administrator. Execute:
Installation can take a few seconds, so it is recommended that you install the printer once as part of your deployment process. Duplicated installations will be quick since the presence of the printer is checked before installation is attempted. The printer is a virtual XPS printer supported on Vista and Windows 7, and on Windows XP with the XPS Essentials Pack.
There is no need to uninstall the printer after conversions, it can be left installed for later access. To uninstall the printer the process must be running as administrator. Execute:
static void pdftron::PDF::Convert::ToXps | ( | const UString & | in_inputFilename, | |
const UString & | in_outputFilename | |||
) | [static] |
Convert the input file to XPS format and save to the specified path.
in_inputFilename | the file to convert to XPS | |
in_outputFilename | the path to the XPS file to create |
static void pdftron::PDF::Convert::ToPdf | ( | PDFDoc & | in_pdfdoc, | |
const UString & | in_filename | |||
) | [static] |
Convert the file or document to PDF and append to the specified PDF document.
in_pdfdoc | the PDFDoc to append the converted document to. The PDFDoc can then be converted to XPS, EMF or SVG using the other functions in this class. | |
in_filename | the path to the document to be converted to pdf |
Formats that require external applications for conversion use the Convert::Printer class and the PDFNet printer to be installed. This is only supported on Windows platforms. Document formats in this category include RTF(MS Word or Wordpad), TXT (Notepad or Wordpad), DOC and DOCX (MS Word), PPT and PPTX (MS PowerPoint), XLS and XLSX (MS Excel), OpenOffice documents, HTML and MHT (Internet Explorer), PUB (MS Publisher), MSG (MS Outlook).
static bool pdftron::PDF::Convert::RequiresPrinter | ( | const UString & | in_filename | ) | [static] |
Utility function to determine if ToPdf or ToXps will require the PDFNet printer to convert a specific external file to PDF.
in_filename | the path to the document to be checked |