new Convert()
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.
Classes
- AdvancedImagingConvertOptions
- CADConvertOptions
- ConversionOptions
- EPUBOutputOptions
- ExcelOutputOptions
- HTMLOutputOptions
- OfficeToPDFOptions
- OutputOptionsOCR
- PowerPointOutputOptions
- StructuredOutputOptions
- SVGConvertOptions
- SVGOutputOptions
- TiffOutputOptions
- WordOutputOptions
- XODOutputOptions
- XPSOutputCommonOptions
- XPSOutputOptions
Members
-
<static> AnnotationOutputFlag
-
Type:
- number
Properties:
Name Type Description e_internal_xfdf
number include the annotation file in the XOD output. This is the default option e_external_xfdf
number output the annotation file externally to the same output path with extension .xfdf. This is not available when using streaming conversion e_flatten
number flatten all annotations that are not link annotations -
<static> FlattenFlag
-
Type:
- number
Properties:
Name Type Description e_off
number Disable flattening and convert all content as is. e_simple
number Feature reduce PDF to a simple two layer representation consisting of a single background RGB image and a simple top text layer. e_fast
number 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. e_high_quality
number Preserve vector content where possible. In particular only feature reduce PDF files containing overprint or very complex vector content. Currently this option can only be used with XODOutputOptions. -
<static> FlattenThresholdFlag
-
Type:
- number
Properties:
Name Type Description e_very_strict
number Render (flatten) any text that is clipped or occluded. e_strict
number Render text that are marginally clipped or occluded. e_default
number Render text that are somewhat clipped or occluded. e_keep_most
number Only render text that are seriously clipped or occluded. e_keep_all
number Only render text that are completely occluded, or used as a clipping path. -
<static> OverprintPreviewMode
-
Type:
- number
Properties:
Name Type Description e_op_off
number e_op_on
number e_op_pdfx_on
number -
<static> PrinterMode
-
Type:
- number
Properties:
Name Type Description e_auto
number e_interop_only
number e_printer_only
number e_prefer_builtin_converter
number
Methods
-
<static> createAdvancedImagingConvertOptions()
-
Method to create an AdvancedImagingConvertOptions object
Returns:
A promise that resolves to a PDFNet.Convert.AdvancedImagingConvertOptions.- Type
- Promise.<PDFNet.Convert.AdvancedImagingConvertOptions>
-
<static> createCADConvertOptions()
-
Method to create a CADConvertOptions object
Returns:
A promise that resolves to a PDFNet.Convert.CADConvertOptions.- Type
- Promise.<PDFNet.Convert.CADConvertOptions>
-
<static> createEPUBOutputOptions()
-
Method to create an EPUBOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.EPUBOutputOptions.- Type
- Promise.<PDFNet.Convert.EPUBOutputOptions>
-
<static> createExcelOutputOptions()
-
Method to create a ExcelOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.ExcelOutputOptions.- Type
- Promise.<PDFNet.Convert.ExcelOutputOptions>
-
<static> createHTMLOutputOptions()
-
Method to create an HTMLOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.HTMLOutputOptions.- Type
- Promise.<PDFNet.Convert.HTMLOutputOptions>
-
<static> createOfficeTemplateWithFilter(in_stream [, options])
-
Create a TemplateDocument object from an office file suitable for generating any number of PDFs from supplied template data. Template filling will be performed entirely within PDFNet, and handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, and .xls format This method does not perform any template filling and can be expected to return quickly. To do the actual work, use the returned TemplateDocument object
Parameters:
Name Type Argument Description in_stream
PDFNet.Filter the source document data. options
PDFNet.Obj | PDFNet.Convert.ConversionOptions <optional>
the office to pdf conversion options - See:
-
- TemplateDocument 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
- ConversionOptions
Returns:
A promise that resolves to a TemplateDocument object which encapsulates this particular office template.- Type
- Promise.<PDFNet.TemplateDocument>
-
<static> createOfficeTemplateWithPath(in_filename [, options])
-
Create a TemplateDocument object from an office file suitable for generating any number of PDFs from supplied template data. Template filling will be performed entirely within PDFNet, and handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, and .xls format This method does not perform any template filling and can be expected to return quickly. To do the actual work, use the returned TemplateDocument object
Parameters:
Name Type Argument Description in_filename
string the path to the source document. options
PDFNet.Obj | PDFNet.Convert.ConversionOptions <optional>
the office to pdf conversion options - See:
-
- TemplateDocument 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
- ConversionOptions
Returns:
A promise that resolves to a TemplateDocument object which encapsulates this particular office template.- Type
- Promise.<PDFNet.TemplateDocument>
-
<static> createOfficeToPDFOptions(JSON)
-
Method to create a OfficeToPDFOptions object.
Parameters:
Name Type Description JSON
string data containing options values for OfficeToPDFOptions. Returns:
A promise that resolves to a PDFNet.Convert.OfficeToPDFOptions.- Type
- Promise.<PDFNet.Convert.OfficeToPDFOptions>
-
<static> createPowerPointOutputOptions()
-
Method to create a PowerPointOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.PowerPointOutputOptions.- Type
- Promise.<PDFNet.Convert.PowerPointOutputOptions>
-
<static> createReflow(in_page, json_zones)
-
Parameters:
Name Type Description in_page
PDFNet.Page json_zones
string Returns:
A promise that resolves to an object of type: "PDFNet.Reflow"- Type
- Promise.<PDFNet.Reflow>
-
<static> createSVGConvertOptions()
-
Method to create a SVGConvertOptions object
Returns:
A promise that resolves to a PDFNet.Convert.SVGConvertOptions.- Type
- Promise.<PDFNet.Convert.SVGConvertOptions>
-
<static> createSVGOutputOptions()
-
Method to create an SVGOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.SVGOutputOptions.- Type
- Promise.<PDFNet.Convert.SVGOutputOptions>
-
<static> createTiffOutputOptions()
-
Method to create an TiffOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.TiffOutputOptions.- Type
- Promise.<PDFNet.Convert.TiffOutputOptions>
-
<static> createWordOutputOptions()
-
Method to create a WordOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.WordOutputOptions.- Type
- Promise.<PDFNet.Convert.WordOutputOptions>
-
<static> createXODOutputOptions()
-
Method to create an XODOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.XODOutputOptions.- Type
- Promise.<PDFNet.Convert.XODOutputOptions>
-
<static> createXPSOutputOptions()
-
Method to create an XPSOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.XPSOutputOptions.- Type
- Promise.<PDFNet.Convert.XPSOutputOptions>
-
<static> docToEmf(in_pdfdoc, in_filename)
-
Convert the PDFDoc to EMF and save to the specified path
Parameters:
Name Type Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to convert to EMF in_filename
string the path to the EMF files to create, one file per page Note: This method is available only on Windows platforms. Returns:
- Type
- Promise.<void>
-
<static> docToSvg(in_pdfdoc, in_filename)
-
Convert the PDFDoc to SVG and save to the specified path
Parameters:
Name Type Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to convert to SVG in_filename
string the path to the SVG files to create, one file per page Returns:
- Type
- Promise.<void>
-
<static> docToSvgWithOptions(in_pdfdoc, in_filename [, options])
-
Convert the PDFDoc to SVG and save to the specified path
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to convert to SVG in_filename
string the path to the SVG files to create, one file per page options
PDFNet.Obj | PDFNet.Convert.SVGOutputOptions <optional>
the conversion options Returns:
- Type
- Promise.<void>
-
<static> fileToEpub(in_filename, output_path [, html_options] [, epub_options])
-
Convert a file to EPUB format and save to the specified path
Parameters:
Name Type Argument Description in_filename
string the file to convert to EPUB output_path
string the path to the EPUB file to create html_options
PDFNet.Obj | PDFNet.Convert.HTMLOutputOptions <optional>
the conversion options epub_options
PDFNet.Obj | PDFNet.Convert.EPUBOutputOptions <optional>
the conversion options Note: Requires the Convert::Printer class for all file formats that ToPdf also requires. Returns:
- Type
- Promise.<void>
-
<static> fileToExcel(in_filename, output_path [, options])
-
Parameters:
Name Type Argument Description in_filename
string output_path
string options
PDFNet.Obj | PDFNet.Convert.ExcelOutputOptions <optional>
Returns:
- Type
- Promise.<void>
-
<static> fileToHtml(in_filename, output_path [, options])
-
Convert a file to HTML and save to the specified path In e_reflow_paragraphs mode, this conversion requires that the optional PDFTron pdf2html add-on module is available.
Parameters:
Name Type Argument Description in_filename
string the file to convert to HTML output_path
string the path to where generated content will be stored options
PDFNet.Obj | PDFNet.Convert.HTMLOutputOptions <optional>
the conversion options Note: Requires the Convert::Printer class for all file formats that ToPdf also requires. Returns:
- Type
- Promise.<void>
-
<static> fileToPowerPoint(in_filename, output_path [, options])
-
Parameters:
Name Type Argument Description in_filename
string output_path
string options
PDFNet.Obj | PDFNet.Convert.PowerPointOutputOptions <optional>
Returns:
- Type
- Promise.<void>
-
<static> fileToTiff(in_filename, output_path [, options])
-
Convert a file to multipage TIFF and save to the specified path
Parameters:
Name Type Argument Description in_filename
string the file to convert to multipage TIFF output_path
string the path to the TIFF file to create options
PDFNet.Obj | PDFNet.Convert.TiffOutputOptions <optional>
the conversion options Returns:
- Type
- Promise.<void>
-
<static> fileToTiffWithBuffer(fileData, fileType [, options])
-
Convert a file in a buffer to multipage TIFF
Parameters:
Name Type Argument Description fileData
ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray buffer containing the file to convert to multipage TIFF fileType
string the filename extension of the file. options
PDFNet.Obj | PDFNet.Convert.TiffOutputOptions <optional>
the conversion options Returns:
A promise that resolves to the TIFF file in an buffer- Type
- Promise.<Uint8Array>
-
<static> fileToTiffWithFilter(in_filename [, options])
-
Convert a file to multipage TIFF and write to the provided filter
Parameters:
Name Type Argument Description in_filename
string the file to convert to multipage TIFF options
PDFNet.Obj | PDFNet.Convert.TiffOutputOptions <optional>
the conversion options - See:
-
- TiffOutputOptions
Returns:
A promise that resolves to an object of type: "PDFNet.Filter"- Type
- Promise.<PDFNet.Filter>
-
<static> fileToWord(in_filename, output_path [, options])
-
Parameters:
Name Type Argument Description in_filename
string output_path
string options
PDFNet.Obj | PDFNet.Convert.WordOutputOptions <optional>
Returns:
- Type
- Promise.<void>
-
<static> fileToXod(in_filename, output_filename [, options])
-
Convert the input file to XOD format and save to the specified path
Parameters:
Name Type Argument Description in_filename
string the file to convert to XOD output_filename
string the path to the XOD file to create options
PDFNet.Obj | PDFNet.Convert.XODOutputOptions <optional>
the conversion options Note: Requires the Convert::Printer class for all file formats that ToPdf also requires. Returns:
- Type
- Promise.<void>
-
<static> fileToXodStream(in_filename [, options])
-
Generate a stream that incrementally converts the input file to XOD format.
Parameters:
Name Type Argument Description in_filename
string the file to convert to XOD options
PDFNet.Obj | PDFNet.Convert.XODOutputOptions <optional>
the conversion options - See:
-
- XODOutputOptions
- ToPdf() Note: Requires the Convert::Printer class for all file formats that ToPdf also requires.
Returns:
A promise that resolves to a filter from which the file can be read incrementally.- Type
- Promise.<PDFNet.Filter>
-
<static> fileToXodWithBuffer(fileData, fileType [, options])
-
Convert the input file to XOD format and save to a buffer
Parameters:
Name Type Argument Description fileData
ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the file to convert to XOD fileType
string the filename extension of the file. options
PDFNet.Obj | PDFNet.Convert.XODOutputOptions <optional>
the conversion options Returns:
A promise that resolves to the XOD file in a buffer Note: Requires the Convert::Printer class for all file formats that ToPdf also requires.- Type
- Promise.<Uint8Array>
-
<static> fileToXps(in_inputFilename, in_outputFilename [, options])
-
Convert the input file to XPS format and save to the specified path
Parameters:
Name Type Argument Description in_inputFilename
string the file to convert to XPS in_outputFilename
string the path to the XPS file to create options
PDFNet.Obj | PDFNet.Convert.XPSOutputOptions <optional>
the conversion options - See:
-
- XPSOutputOptions
- ToPdf() Note: Requires the Convert::Printer class for all file formats that ToPdf also requires.
Returns:
- Type
- Promise.<void>
-
<static> fileToXpsWithBuffer(fileData, fileType [, options])
-
Convert the input file to XPS format and save to a buffer
Parameters:
Name Type Argument Description fileData
ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the file to convert to XPS fileType
string the filename extension of the file. options
PDFNet.Obj | PDFNet.Convert.XPSOutputOptions <optional>
the conversion options Returns:
A promise that resolves to the XPS file in a buffer Note: Requires the Convert::Printer class for all file formats that ToPdf also requires.- Type
- Promise.<Uint8Array>
-
<static> fromCAD(in_pdfdoc, in_filename [, opts])
-
Convert the specified CAD file to PDF and append converted pages to the specified PDF document. This conversion requires that the optional PDFTron CAD add-on module is available. See the `CADConvertOptions` class for the available options. See also: the 'CADModule' class
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to append to in_filename
string the path to the CAD document to convert opts
PDFNet.Obj | PDFNet.Convert.CADConvertOptions <optional>
The options to use when converting. Returns:
- Type
- Promise.<void>
-
<static> fromDICOM(in_pdfdoc, in_filename [, opts])
-
Convert the specified AdvancedImaging file to PDF and append converted pages to the specified PDF document. This conversion requires that the optional PDFTron AdvancedImaging add-on module is available. See also: the 'AdvancedImagingModule' class
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to append to in_filename
string the path to the CAD document to convert opts
PDFNet.Obj | PDFNet.Convert.AdvancedImagingConvertOptions <optional>
The options to use when converting. Returns:
- Type
- Promise.<void>
-
<static> fromEmf(in_pdfdoc, in_filename)
-
Convert the specified EMF to PDF and append converted pages to to the specified PDF document. EMF will be fitted to the page.
Parameters:
Name Type Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to append to in_filename
string the path to the EMF document to convert Note: This method is available only on Windows platforms. Returns:
- Type
- Promise.<void>
-
<static> fromSVG(in_pdfdoc, in_filename [, opts])
-
Convert the specified SVG file to PDF and append converted pages to the specified PDF document.
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to append to in_filename
string the path to the CAD document to convert opts
PDFNet.Obj | PDFNet.Convert.SVGConvertOptions <optional>
The options to use when converting. Returns:
- Type
- Promise.<void>
-
<static> fromText(in_pdfdoc, in_filename [, options])
-
Convert the specified plain text file to PDF and append converted pages to the specified PDF document.
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to append to in_filename
string the path to the plain text document to convert options
PDFNet.Obj <optional>
the conversion options. The available 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. | Returns:
- Type
- Promise.<void>
-
<static> fromTextWithBuffer(in_pdfdoc, fileData [, options])
-
Convert the specified plain text file contained in a buffer to PDF and append converted pages to the specified PDF document.
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to append to fileData
ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the buffer containing the plain text document to convert options
PDFNet.Obj <optional>
the conversion options. The available 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. | Returns:
- Type
- Promise.<void>
-
<static> fromTiff(in_pdfdoc, in_data)
-
Convert the specified TIFF filter to PDF and append converted pages to the specified PDF document.
Parameters:
Name Type Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to append to in_data
PDFNet.Filter the source TIFF data. Returns:
- Type
- Promise.<void>
-
<static> fromXps(in_pdfdoc, in_filename)
-
Convert the specified XPS document to PDF and append converted pages to the specified PDF document.
Parameters:
Name Type Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to append to in_filename
string the path to the XPS document to convert Returns:
- Type
- Promise.<void>
-
<static> fromXpsMem(in_pdfdoc, buf)
-
Convert the specified XPS document contained in memory to PDF and append converted pages to the specified PDF document.
Parameters:
Name Type Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to append to buf
ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the buffer containing the xps document Returns:
- Type
- Promise.<void>
-
<static> office2PDF(input [, options])
-
Convert the an office document (in .docx, .xlsx, pptx, or .doc format) to pdf.
Parameters:
Name Type Argument Description input
string | ArrayBuffer Either a url from which to download the file or an ArrayBuffer containing the file data. options
PDFNet.Obj | PDFNet.Convert.OfficeToPDFOptions <optional>
An object containing conversion options Returns:
A promise that resolves to a "PDFDoc".- Type
- Promise.<PDFNet.PDFDoc>
-
<static> office2PDFBuffer(input [, options])
-
Parameters:
Name Type Argument Description input
string | ArrayBuffer Either a url from which to download the file or an ArrayBuffer containing the file data. options
PDFNet.Obj | PDFNet.Convert.OfficeToPDFOptions <optional>
An object containing conversion options Returns:
A promise that resolves to an Uint8Array containing the resulting PDF data.- Type
- Promise.<Uint8Array>
-
<static> officeToPdfWithFilter(in_stream [, options])
-
Convert the an office document (in .docx, .xlsx, pptx, or .doc 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:
Name Type Argument Description in_stream
PDFNet.Filter the source document data. options
PDFNet.Obj | PDFNet.Convert.OfficeToPDFOptions <optional>
the conversion options - See:
-
- ConversionOptions
- StreamingPDFConversion() if you would like more control over the conversion process
Returns:
A promise that resolves to a PDFDoc object- Type
- Promise.<PDFNet.PDFDoc>
-
<static> officeToPdfWithPath(in_filename [, options])
-
Convert the an office document (in .docx, .xlsx, pptx, or .doc 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:
Name Type Argument Description in_filename
string the path to the source document. options
PDFNet.Obj | PDFNet.Convert.OfficeToPDFOptions <optional>
the conversion options - See:
-
- ConversionOptions
- StreamingPDFConversion() if you would like more control over the conversion process
Returns:
A promise that resolves to a PDFDoc object- Type
- Promise.<PDFNet.PDFDoc>
-
<static> pageToEmf(in_page, in_filename)
-
Convert the Page to EMF and save to the specified path
Parameters:
Name Type Description in_page
PDFNet.Page the Page to convert to EMF in_filename
string the path to the EMF file to create Note: This method is available only on Windows platforms. Returns:
- Type
- Promise.<void>
-
<static> pageToHtml(page)
-
Convert a page to HTML and return a string of the html
Parameters:
Name Type Description page
PDFNet.Page the page to convert to HTML Returns:
A promise that resolves to a string containing the page's html- Type
- Promise.<string>
-
<static> pageToHtmlZoned(page, json_zones)
-
Parameters:
Name Type Description page
PDFNet.Page json_zones
string Returns:
A promise that resolves to an object of type: "string"- Type
- Promise.<string>
-
<static> pageToSvg(in_page, output_filename)
-
Convert the Page to SVG and save to the specified path
Parameters:
Name Type Description in_page
PDFNet.Page the Page to convert to SVG output_filename
string the path to the SVG file to create Returns:
- Type
- Promise.<void>
-
<static> pageToSvgWithOptions(in_page, output_filename [, options])
-
Convert the Page to SVG and save to the specified path
Parameters:
Name Type Argument Description in_page
PDFNet.Page the Page to convert to SVG output_filename
string the path to the SVG file to create options
PDFNet.Obj | PDFNet.Convert.SVGOutputOptions <optional>
the conversion options Returns:
- Type
- Promise.<void>
-
<static> printerGetMode()
-
Get the current mode for print jobs.
Returns:
A promise that resolves to the current print mode- Type
- Promise.<number>
Example
Return value enum: <pre> PDFNet.Convert.PrinterMode = { e_auto : 0 e_interop_only : 1 e_printer_only : 2 e_prefer_builtin_converter : 3 } </pre>
-
<static> printerGetPrinterName()
-
Get the name of the PDFNet printer installed in this process session.
Returns:
A promise that resolves to the Unicode name of the PDFNet printer Note: if no printer was installed in this process then the predefined string "PDFTron PDFNet" will be returned.- Type
- Promise.<string>
-
<static> printerInstall( [in_printerName])
-
Install the PDFNet printer. 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. There is no need to uninstall the printer after conversions, it can be left installed for later access.
Parameters:
Name Type Argument Description in_printerName
string <optional>
the name of the printer to install and use for conversions. If in_printerName is not provided then the name "PDFTron PDFNet" is used. Note: Installing and uninstalling printer drivers requires the process to be running as administrator. Returns:
- Type
- Promise.<void>
-
<static> printerIsInstalled( [in_printerName])
-
Determine if the PDFNet printer is installed
Parameters:
Name Type Argument Description in_printerName
string <optional>
the name of the printer to install and use for conversions. If in_printerName is not provided then the name "PDFTron PDFNet" is used. Returns:
A promise that resolves to true if the named printer is installed, false otherwise Note: may or may not check if the printer with the given name is actually a PDFNet printer.- Type
- Promise.<boolean>
-
<static> printerSetMode(print_mode)
-
Configure how PDFNet prints documents.
Parameters:
Name Type Description print_mode
number PDFNet.Convert.PrinterMode = { e_auto : 0 e_interop_only : 1 e_printer_only : 2 e_prefer_builtin_converter : 3 }
set the print mode. Default is e_auto.Returns:
- Type
- Promise.<void>
-
<static> printerSetPrinterName( [in_printerName])
-
Set the name of the PDFNet printer installed in this process session.
Parameters:
Name Type Argument Description in_printerName
string <optional>
Returns:
A promise that resolves to the Unicode name of the PDFNet printer Note: if no printer was installed in this process then the predefined string "PDFTron PDFNet" will be used.- Type
- Promise.<void>
-
<static> printerUninstall()
-
Uninstall all printers using the PDFNet printer driver. Note: Installing and uninstalling printer drivers requires the process to be running as administrator. Only the "PDFTron PDFNet" printer can be uninstalled with this function.
Returns:
- Type
- Promise.<void>
-
<static> requiresPrinter(in_filename)
-
Utility function to determine if ToPdf or ToXps will require the PDFNet printer to convert a specific external file to PDF.
Parameters:
Name Type Description in_filename
string the path to the document to be checked Returns:
A promise that resolves to 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- Type
- Promise.<boolean>
-
<static> streamingPdfConversionWithFilter(in_stream [, options])
-
Create a DocumentConversion object suitable for converting an office document (in .docx, .xlsx, pptx, or .doc 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 does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object.
Parameters:
Name Type Argument Description in_stream
PDFNet.Filter the source document data. options
PDFNet.Obj | PDFNet.Convert.ConversionOptions <optional>
the conversion options - See:
-
- 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
- ConversionOptions
Returns:
A promise that resolves to a DocumentConversion object which encapsulates this particular conversion.- Type
- Promise.<PDFNet.DocumentConversion>
-
<static> streamingPdfConversionWithPath(in_filename [, options])
-
Create a DocumentConversion object suitable for converting a file to pdf. Handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, .xls, .png, .jpg, .bmp, .gif, .jp2, .tif, .txt, .xml and .md format This conversion will be performed entirely within PDFNet, and does not rely on any external functionality. This method allows for more control over the conversion process than the single call ToPDF() interface. It does not perform any conversion logic immediately, and can be expected to return quickly. To perform the actual conversion, use the returned DocumentConversion object.
Parameters:
Name Type Argument Description in_filename
string the path to the source document. options
PDFNet.Obj | PDFNet.Convert.ConversionOptions <optional>
the conversion options - See:
-
- 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
- ConversionOptions
Returns:
A promise that resolves to a DocumentConversion object which encapsulates this particular conversion.- Type
- Promise.<PDFNet.DocumentConversion>
-
<static> streamingPdfConversionWithPdfAndFilter(in_pdfdoc, in_stream [, options])
-
Create a DocumentConversion object suitable for converting an office document (in .docx, .xlsx, pptx, or .doc 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 does not perform any conversion logic and can be expected to return quickly. To do the actual conversion, use the returned DocumentConversion object.
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the conversion result will be appended to this pdf. in_stream
PDFNet.Filter the source document data. options
PDFNet.Obj | PDFNet.Convert.ConversionOptions <optional>
the conversion options - See:
-
- 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
- ConversionOptions
Returns:
A promise that resolves to a DocumentConversion object which encapsulates this particular conversion.- Type
- Promise.<PDFNet.DocumentConversion>
-
<static> streamingPdfConversionWithPdfAndPath(in_pdfdoc, in_filename [, options])
-
Create a DocumentConversion object suitable for converting a file to pdf and appending to the specified PDF document. Handles incoming files in .docx, .xlsx, .pptx, .doc, .ppt, .xls, .png, .jpg, .bmp, .gif, .jp2, .tif, .txt, .xml and .md format This conversion will be performed entirely within PDFNet, and does not rely on any external functionality. This method allows for more control over the conversion process than the single call ToPDF() interface. It does not perform any conversion logic immediately, and can be expected to return quickly. To perform the actual conversion, use the returned DocumentConversion object.
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the conversion result will be appended to this pdf. in_filename
string the path to the source document. options
PDFNet.Obj | PDFNet.Convert.ConversionOptions <optional>
the conversion options - See:
-
- 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
- ConversionOptions
Returns:
A promise that resolves to a DocumentConversion object which encapsulates this particular conversion.- Type
- Promise.<PDFNet.DocumentConversion>
-
<static> toEpub(in_pdfdoc, output_path [, html_options] [, epub_options])
-
Convert the PDFDoc to EPUB format and save to the specified path
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to convert to EPUB output_path
string the path to the EPUB file to create html_options
PDFNet.Obj | PDFNet.Convert.HTMLOutputOptions <optional>
the conversion options epub_options
PDFNet.Obj | PDFNet.Convert.EPUBOutputOptions <optional>
the conversion options Returns:
- Type
- Promise.<void>
-
<static> toExcel(in_pdfdoc, output_path [, options])
-
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc output_path
string options
PDFNet.Obj | PDFNet.Convert.ExcelOutputOptions <optional>
Returns:
- Type
- Promise.<void>
-
<static> toHtml(in_pdfdoc, output_path [, options])
-
Convert the PDF to HTML and save to the specified path In e_reflow_paragraphs mode, this conversion requires that the optional PDFTron pdf2html add-on module is available.
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDF doc to convert to HTML output_path
string the path to where generated content will be stored options
PDFNet.Obj | PDFNet.Convert.HTMLOutputOptions <optional>
the conversion options Returns:
- Type
- Promise.<void>
-
<static> toPdf(in_pdfdoc, in_filename)
-
Convert the file or document to PDF and append to the specified PDF document
Parameters:
Name Type Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc 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
string the path to the document to be converted to pdf Note: Internally formats include BMP, EMF, JPEG, PNG, TIF, XPS. Note: 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). Returns:
- Type
- Promise.<void>
-
<static> toPdfWithBuffer(in_pdfdoc, fileData, fileType)
-
Convert the file or document to PDF and append to the specified PDF document
Parameters:
Name Type Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc 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. fileData
ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the buffer containing the document to be converted to pdf fileType
string the filename extension of the document. Note: Internally formats include BMP, EMF, JPEG, PNG, TIF, XPS. Note: 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). Returns:
- Type
- Promise.<void>
-
<static> toPowerPoint(in_pdfdoc, output_path [, options])
-
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc output_path
string options
PDFNet.Obj | PDFNet.Convert.PowerPointOutputOptions <optional>
Returns:
- Type
- Promise.<void>
-
<static> toTiff(in_pdfdoc, output_path [, options])
-
Convert the PDF to multipage TIFF and save to the specified path
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDF doc to convert to multipage output_path
string the path to the TIFF file to create options
PDFNet.Obj | PDFNet.Convert.TiffOutputOptions <optional>
the conversion options Returns:
- Type
- Promise.<void>
-
<static> toTiffBuffer(in_pdfdoc [, options])
-
Convert the PDF to multipage TIFF
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDF doc to convert to multipage options
PDFNet.Obj | PDFNet.Convert.TiffOutputOptions <optional>
the conversion options Returns:
A promise that resolves to the TIFF file in an buffer- Type
- Promise.<Uint8Array>
-
<static> toTiffWithFilter(in_pdfdoc [, options])
-
Convert the PDF to multipage TIFF and write to the provided filter
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDF doc to convert to multipage TIFF options
PDFNet.Obj | PDFNet.Convert.TiffOutputOptions <optional>
the conversion options - See:
-
- TiffOutputOptions
Returns:
A promise that resolves to an object of type: "PDFNet.Filter"- Type
- Promise.<PDFNet.Filter>
-
<static> toWord(in_pdfdoc, output_path [, options])
-
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc output_path
string options
PDFNet.Obj | PDFNet.Convert.WordOutputOptions <optional>
Returns:
- Type
- Promise.<void>
-
<static> toXod(in_pdfdoc, output_filename [, options])
-
Convert the input file to XOD format and save to the specified path
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to convert to XOD output_filename
string the path to the XOD file to create options
PDFNet.Obj | PDFNet.Convert.XODOutputOptions <optional>
the conversion options Returns:
- Type
- Promise.<void>
-
<static> toXodBuffer(in_pdfdoc [, options])
-
Convert the input file to XOD format and save to a buffer
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to convert to XOD options
PDFNet.Obj | PDFNet.Convert.XODOutputOptions <optional>
the conversion options Returns:
A promise that resolves to the XOD file in a buffer- Type
- Promise.<Uint8Array>
-
<static> toXodStream(in_pdfdoc [, options])
-
Generate a stream that incrementally converts the input file to XOD format.
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to convert to XOD options
PDFNet.Obj | PDFNet.Convert.XODOutputOptions <optional>
the conversion options - See:
-
- XODOutputOptions
- ToPdf()
Returns:
A promise that resolves to a filter from which the file can be read incrementally.- Type
- Promise.<PDFNet.Filter>
-
<static> toXps(in_pdfdoc, output_filename [, options])
-
Convert the PDFDoc to XPS and save to the specified path
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to convert to XPS output_filename
string the path to the document to create options
PDFNet.Obj | PDFNet.Convert.XPSOutputOptions <optional>
the conversion options - See:
-
- XPSOutputOptions
Returns:
- Type
- Promise.<void>
-
<static> toXpsBuffer(in_pdfdoc [, options])
-
Convert the PDFDoc to XPS and save to a buffer
Parameters:
Name Type Argument Description in_pdfdoc
PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc the PDFDoc to convert to XPS options
PDFNet.Obj | PDFNet.Convert.XPSOutputOptions <optional>
the conversion Returns:
A promise that resolves to the XPS file in a buffer- Type
- Promise.<Uint8Array>