All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pdftron::PDF::Convert Class Reference

#include <Convert.h>

Classes

class  EPUBOutputOptions
 
class  HTMLOutputOptions
 
class  Printer
 
class  SVGOutputOptions
 
class  TiffOutputOptions
 
class  XODOutputOptions
 
class  XPSOutputCommonOptions
 
class  XPSOutputOptions
 

Public Types

enum  FlattenThresholdFlag {
  e_very_strict, e_strict, e_default, e_keep_most,
  e_keep_all
}
 
enum  FlattenFlag { e_off, e_simple, e_fast }
 

Static Public Member Functions

static void FromXps (PDFDoc &in_pdfdoc, const UString &in_filename)
 
static void FromXps (PDFDoc &in_pdfdoc, const char *buf, size_t buf_sz)
 
static void FromEmf (PDFDoc &in_pdfdoc, const UString &in_filename)
 
static void FromText (PDFDoc &in_pdfdoc, const UString &in_filename, const SDF::Obj &in_options=SDF::Obj())
 
static void ToEmf (PDFDoc &in_pdfdoc, const UString &in_filename)
 
static void ToEmf (Page &in_page, const UString &in_filename)
 
static void ToSvg (PDFDoc &in_pdfdoc, const UString &in_filename, const SVGOutputOptions &in_options=SVGOutputOptions())
 
static void ToSvg (Page &in_page, const UString &in_filename, const SVGOutputOptions &in_options=SVGOutputOptions())
 
static void ToXps (PDFDoc &in_pdfdoc, const UString &in_filename, const XPSOutputOptions &options=XPSOutputOptions())
 
static void ToXps (const UString &in_inputFilename, const UString &in_outputFilename, const XPSOutputOptions &options=XPSOutputOptions())
 
static void ToXod (const UString &in_filename, const UString &out_filename, const XODOutputOptions &options=XODOutputOptions())
 
static void ToXod (PDFDoc &in_pdfdoc, const UString &out_filename, const XODOutputOptions &options=XODOutputOptions())
 
static void ToHtml (const UString &in_filename, const UString &out_path, const HTMLOutputOptions &options=HTMLOutputOptions())
 
static void ToHtml (PDFDoc &in_pdfdoc, const UString &out_path, const HTMLOutputOptions &options=HTMLOutputOptions())
 
static void ToEpub (const UString &in_filename, const UString &out_path, const HTMLOutputOptions &html_options=HTMLOutputOptions(), const EPUBOutputOptions &epub_options=EPUBOutputOptions())
 
static void ToEpub (PDFDoc &in_pdfdoc, const UString &out_path, const HTMLOutputOptions &html_options=HTMLOutputOptions(), const EPUBOutputOptions &epub_options=EPUBOutputOptions())
 
static void ToTiff (const UString &in_filename, const UString &out_path, const TiffOutputOptions &options=TiffOutputOptions())
 
static void ToTiff (PDFDoc &in_pdfdoc, const UString &out_path, const TiffOutputOptions &options=TiffOutputOptions())
 
static Filters::Filter ToXod (const UString &in_filename, const XODOutputOptions &options=XODOutputOptions())
 
static Filters::Filter ToXod (PDFDoc &in_pdfdoc, const XODOutputOptions &options=XODOutputOptions())
 
static ConversionMonitor ToXodWithMonitor (PDFDoc &in_pdfdoc, const XODOutputOptions &options=XODOutputOptions())
 
static void WordToPDF (PDFDoc &in_pdfdoc, const UString &in_filename, WordToPDFOptions *options)
 
static DocumentConversion WordToPDFConversion (PDFDoc &in_pdfdoc, const UString &in_filename, WordToPDFOptions *options)
 
static void WordToPDF (PDFDoc &in_pdfdoc, Filters::Filter in_stream, WordToPDFOptions *options)
 
static DocumentConversion WordToPDFConversion (PDFDoc &in_pdfdoc, Filters::Filter in_stream, WordToPDFOptions *options)
 
static void ToPdf (PDFDoc &in_pdfdoc, const UString &in_filename)
 
static bool RequiresPrinter (const UString &in_filename)
 

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:

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:

Definition at line 90 of file Convert.h.

Member Enumeration Documentation

Enumerator
e_off 

Disable flattening and convert all content as is.

e_simple 

Feature reduce PDF to a simple two layer representation consisting of a single background RGB image and a simple top text layer.

e_fast 

Feature reduce PDF while trying to preserve some complex PDF features (such as vector figures, transparency, shadings, blend modes, Type3 fonts etc.) for pages that are already fast to render. This option can also result in smaller & faster files compared to e_simple, but the pages may have more complex structure.

Definition at line 106 of file Convert.h.

Enumerator
e_very_strict 

Render (flatten) any text that is clipped or occluded.

e_strict 

Render text that are marginally clipped or occluded.

e_default 

Render text that are somewhat clipped or occluded.

e_keep_most 

Only render text that are seriously clipped or occluded.

e_keep_all 

Only render text that are completely occluded, or used as a clipping path.

Definition at line 93 of file Convert.h.

Member Function Documentation

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_pdfdocthe PDFDoc to append to
in_filenamethe path to the EMF document to convert
Note
This method is available only on Windows platforms.
static void pdftron::PDF::Convert::FromText ( PDFDoc in_pdfdoc,
const UString in_filename,
const SDF::Obj in_options = SDF::Obj() 
)
static

Convert the specified plain text file to PDF and append converted pages to the specified PDF document.

Parameters
in_pdfdocthe PDFDoc to append to
in_filenamethe path to the plain text document to convert
Note
in_options the conversion options. The availble options are:
Option Name Type Note
BytesPerBite Integer In bytes. Use for streaming conversion only.
FontFace String Set the font face used for the conversion.
FontSize Integer Set the font size used for the conversion.
LineHeightMultiplier Double Set the line height multiplier used for the conversion.
MarginBottom Double In inches. Set the bottom margin of the page.
MarginLeft Double In inches. Set the left margin of the page.
MarginRight Double In inches. Set the right margin of the page.
MarginTop Double In inches. Set the top margin of the page.
PageHeight Double In inches. Set the page height.
PageWidth Double In inches. Set the page width.
UseSourceCodeFormatting Boolean Set whether to use mono font for the conversion.
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 the specified PDF document.

Parameters
in_pdfdocthe PDFDoc to append to
in_filenamethe path to the XPS document to convert
static void pdftron::PDF::Convert::FromXps ( PDFDoc in_pdfdoc,
const char *  buf,
size_t  buf_sz 
)
static

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

Parameters
in_pdfdocthe PDFDoc to append to
bufthe buffer containing the xps document
buf_szthe size of the buffer
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_filenamethe 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
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_pdfdocthe PDFDoc to convert to EMF
in_filenamethe 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_pagethe Page to convert to EMF
in_filenamethe path to the EMF file to create
Note
This method is available only on Windows platforms.
static void pdftron::PDF::Convert::ToEpub ( const UString in_filename,
const UString out_path,
const HTMLOutputOptions html_options = HTMLOutputOptions(),
const EPUBOutputOptions epub_options = EPUBOutputOptions() 
)
static

Convert a file to EPUB format and save to the specified path

Parameters
in_inputFilenamethe file to convert to EPUB
out_paththe path to where generated content will be stored
optionsthe conversion options
See Also
HTMLOutputOptions
EPUBOutputOptions
ToPdf()
Note
: Requires the Convert::Printer class for all file formats that ToPdf also requires.
static void pdftron::PDF::Convert::ToEpub ( PDFDoc in_pdfdoc,
const UString out_path,
const HTMLOutputOptions html_options = HTMLOutputOptions(),
const EPUBOutputOptions epub_options = EPUBOutputOptions() 
)
static

Convert the PDFDoc to EPUB format and save to the specified path

Parameters
in_pdfdocthe PDFDoc to convert to EPUB
out_paththe path to where generated content will be stored
optionsthe conversion options
See Also
HTMLOutputOptions
EPUBOutputOptions
ToPdf()
static void pdftron::PDF::Convert::ToHtml ( const UString in_filename,
const UString out_path,
const HTMLOutputOptions options = HTMLOutputOptions() 
)
static

Convert a file to HTML and save to the specified path

Parameters
in_inputFilenamethe file to convert to HTML
out_paththe path to where generated content will be stored
optionsthe conversion options
See Also
HTMLOutputOptions
ToPdf()
Note
: Requires the Convert::Printer class for all file formats that ToPdf also requires.
static void pdftron::PDF::Convert::ToHtml ( PDFDoc in_pdfdoc,
const UString out_path,
const HTMLOutputOptions options = HTMLOutputOptions() 
)
static

Convert the PDF to HTML and save to the specified path

Parameters
in_pdfdocthe PDF doc to convert to HTML
out_paththe path to where generated content will be stored
optionsthe conversion options
See Also
HTMLOutputOptions
ToPdf()
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_pdfdocthe 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_filenamethe 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 void pdftron::PDF::Convert::ToSvg ( PDFDoc in_pdfdoc,
const UString in_filename,
const SVGOutputOptions in_options = SVGOutputOptions() 
)
static

Convert the PDFDoc to SVG and save to the specified path

Parameters
in_pdfdocthe PDFDoc to convert to SVG
in_filenamethe path to the SVG files to create, one file per page
in_optionsthe conversion options
static void pdftron::PDF::Convert::ToSvg ( Page in_page,
const UString in_filename,
const SVGOutputOptions in_options = SVGOutputOptions() 
)
static

Convert the Page to SVG and save to the specified path

Parameters
in_pagethe Page to convert to SVG
in_filenamethe path to the SVG file to create
in_optionsthe conversion options
static void pdftron::PDF::Convert::ToTiff ( const UString in_filename,
const UString out_path,
const TiffOutputOptions options = TiffOutputOptions() 
)
static

Convert a file to multipage TIFF and save to the specified path

Parameters
in_inputFilenamethe file to convert to multipage TIFF
out_paththe path to where generated content will be stored
optionsthe conversion options
See Also
TiffOutputOptions
static void pdftron::PDF::Convert::ToTiff ( PDFDoc in_pdfdoc,
const UString out_path,
const TiffOutputOptions options = TiffOutputOptions() 
)
static

Convert the PDF to multipage TIFF and save to the specified path

Parameters
in_pdfdocthe PDF doc to convert to multipage TIFF
out_paththe path to where generated content will be stored
optionsthe conversion options
See Also
TiffOutputOptions
static void pdftron::PDF::Convert::ToXod ( const UString in_filename,
const UString out_filename,
const XODOutputOptions options = XODOutputOptions() 
)
static

Convert the input file to XOD format and save to the specified path

Parameters
in_inputFilenamethe file to convert to XOD
in_outputFilenamethe path to the XOD file to create
optionsthe conversion options
See Also
XODOutputOptions
ToPdf()
Note
: Requires the Convert::Printer class for all file formats that ToPdf also requires.
static void pdftron::PDF::Convert::ToXod ( PDFDoc in_pdfdoc,
const UString out_filename,
const XODOutputOptions options = XODOutputOptions() 
)
static

Convert the input file to XOD format and save to the specified path

Parameters
in_pdfdocthe PDFDoc to convert to XOD
in_outputFilenamethe path to the XOD file to create
optionsthe conversion options
See Also
XODOutputOptions
ToPdf()
static Filters::Filter pdftron::PDF::Convert::ToXod ( const UString in_filename,
const XODOutputOptions options = XODOutputOptions() 
)
static

Generate a stream that incrementally converts the input file to XOD format.

Parameters
in_inputFilenamethe file to convert to XOD
in_outputFilenamethe path to the XOD file to create
optionsthe conversion options
Returns
A filter from which the file can be read incrementally.
See Also
XODOutputOptions
ToPdf()
Note
: Requires the Convert::Printer class for all file formats that ToPdf also requires.
static Filters::Filter pdftron::PDF::Convert::ToXod ( PDFDoc in_pdfdoc,
const XODOutputOptions options = XODOutputOptions() 
)
static

Generate a stream that incrementally converts the input file to XOD format.

Parameters
in_pdfdocthe PDFDoc to convert to XOD
in_outputFilenamethe path to the XOD file to create
optionsthe conversion options
Returns
A filter from which the file can be read incrementally.
See Also
XODOutputOptions
ToPdf()
static ConversionMonitor pdftron::PDF::Convert::ToXodWithMonitor ( PDFDoc in_pdfdoc,
const XODOutputOptions options = XODOutputOptions() 
)
static
static void pdftron::PDF::Convert::ToXps ( PDFDoc in_pdfdoc,
const UString in_filename,
const XPSOutputOptions options = XPSOutputOptions() 
)
static

Convert the PDFDoc to XPS and save to the specified path

Parameters
in_pdfdocthe PDFDoc to convert to XPS
in_filenamethe path to the document to create
optionsthe conversion options
See Also
XPSOutputOptions
static void pdftron::PDF::Convert::ToXps ( const UString in_inputFilename,
const UString in_outputFilename,
const XPSOutputOptions options = XPSOutputOptions() 
)
static

Convert the input file to XPS format and save to the specified path

Parameters
in_inputFilenamethe file to convert to XPS
in_outputFilenamethe path to the XPS file to create
optionsthe conversion options
See Also
XPSOutputOptions
ToPdf()
Note
: Requires the Convert::Printer class for all file formats that ToPdf also requires.
static void pdftron::PDF::Convert::WordToPDF ( PDFDoc in_pdfdoc,
const UString in_filename,
WordToPDFOptions *  options 
)
static

Convert the a Word document (in .docx format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality.

Note
Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion
Parameters
out_docthe conversion result will be appended to this pdf.
in_filenamethe path to the source document. The source must be in .docx format.
optionsthe conversion options
Exceptions
PDFNetException
See Also
WordToPDFOptions
WordToPdfConversion() if you would like more control over the conversion process
static void pdftron::PDF::Convert::WordToPDF ( PDFDoc in_pdfdoc,
Filters::Filter  in_stream,
WordToPDFOptions *  options 
)
static

Convert the a Word document (in .docx format) to pdf and append to the specified PDF document. This conversion is performed entirely within PDFNet, and does not rely on Word interop or any other external functionality.

Note
Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion
Parameters
out_docthe conversion result will be appended to this pdf.
in_streamthe source document data. The source must be in .docx format.
optionsthe conversion options
Exceptions
PDFNetException
See Also
WordToPDFOptions
WordToPdfConversion() if you would like more control over the conversion process
static DocumentConversion pdftron::PDF::Convert::WordToPDFConversion ( PDFDoc in_pdfdoc,
const UString in_filename,
WordToPDFOptions *  options 
)
static

Create a DocumentConversion object suitable for converting a Word document (in .docx format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality.

This method allows for more control over the conversion process than the single call WordToPDF() interface. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object.

See Also
DocumentConversion
Note
Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion
Parameters
out_doc,theconversion result will be appended to this pdf.
in_filename,thepath to the source document. The source must be in .docx format.
options,theconversion options
Returns
A DocumentConversion object which encapsulates this particular conversion.
See Also
WordToPDFOptions
static DocumentConversion pdftron::PDF::Convert::WordToPDFConversion ( PDFDoc in_pdfdoc,
Filters::Filter  in_stream,
WordToPDFOptions *  options 
)
static

Create a DocumentConversion object suitable for converting a Word document (in .docx format) to pdf and appending to the specified PDF document. This conversion will be performed entirely within PDFNet, and does not rely on Word interop or any other external functionality.

This method allows for more control over the conversion process than the single call WordToPDF() interface. This method does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object.

See Also
DocumentConversion
Note
Font requirements: on some systems you may need to specify extra font resources to aid in conversion. Please see http://www.pdftron.com/kb_fonts_and_builtin_office_conversion
Parameters
out_doc,theconversion result will be appended to this pdf.
in_stream,thesource document data. The source must be in .docx format.
options,theconversion options
Returns
A DocumentConversion object which encapsulates this particular conversion.
See Also
WordToPDFOptions

The documentation for this class was generated from the following file:

© 2002-2014 PDFTron Systems Inc.