pdftron::PDF::Convert Class Reference

Converter is a utility class used to convert documents and files to PDF. More...

#include <Convert.h>

List of all members.

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.


Detailed Description

Converter is a utility class used to convert documents and files 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:

 Convert::Printer::Install();

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:

 Convert::Printer::Uninstall();

Member Function Documentation

static void pdftron::PDF::Convert::FromXps ( PDFDoc in_pdfdoc,
const UString in_filename 
) [static]

Convert the specified XPS document to PDF and append converted pages to to the specified PDF document.

Parameters:
in_pdfdoc the PDFDoc to append to
in_filename the path to the XPS document to convert

static void pdftron::PDF::Convert::FromEmf ( PDFDoc in_pdfdoc,
const UString in_filename 
) [static]

Convert the specified EMF to PDF and append converted pages to to the specified PDF document.

EMF will be fitted to the page.

Parameters:
in_pdfdoc the PDFDoc to append to
in_filename the path to the EMF document to convert
Note:
This method is available only on Windows platforms.

static void pdftron::PDF::Convert::ToEmf ( PDFDoc in_pdfdoc,
const UString in_filename 
) [static]

Convert the PDFDoc to EMF and save to the specified path.

Parameters:
in_pdfdoc the PDFDoc to convert to EMF
in_filename the path to the EMF files to create, one file per page
Note:
This method is available only on Windows platforms.

static void pdftron::PDF::Convert::ToEmf ( Page in_page,
const UString in_filename 
) [static]

Convert the Page to EMF and save to the specified path.

Parameters:
in_page the Page to convert to EMF
in_filename the path to the EMF file to create
Note:
This method is available only on Windows platforms.

static void pdftron::PDF::Convert::ToSvg ( PDFDoc in_pdfdoc,
const UString in_filename 
) [static]

Convert the PDFDoc to SVG and save to the specified path.

Parameters:
in_pdfdoc the PDFDoc to convert to SVG
in_filename the path to the SVG files to create, one file per page

static void pdftron::PDF::Convert::ToSvg ( Page in_page,
const UString in_filename 
) [static]

Convert the Page to SVG and save to the specified path.

Parameters:
in_page the Page to convert to SVG
in_filename the path to the SVG file to create

static void pdftron::PDF::Convert::ToXps ( PDFDoc in_pdfdoc,
const UString in_filename 
) [static]

Convert the PDFDoc to XPS and save to the specified path.

Parameters:
in_pdfdoc the PDFDoc to convert to XPS
in_filename the path to the document to create

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.

Parameters:
in_inputFilename the file to convert to XPS
in_outputFilename the path to the XPS file to create
See also:
ToPdf()
Note:
: Requires the Convert::Printer class for all file formats that ToPdf also requires.

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.

Parameters:
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
Note:
Internally formats include BMP, EMF, JPEG, PNG, TIF, XPS.

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.

Parameters:
in_filename the path to the document to be checked
Returns:
true if ToPdf requires the printer to convert the file, false otherwise.
Note:
Current implementation looks only at the file extension not file contents. If the file extension is missing, false will be returned


© 2002-2010 PDFTron Systems Inc.