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
- ConversionOptions
- EPUBOutputOptions
- HTMLOutputOptions
- OfficeToPDFOptions
- SVGOutputOptions
- TiffOutputOptions
- 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.<Core.PDFNet.Convert.AdvancedImagingConvertOptions>
-
<static> createEPUBOutputOptions()
-
Method to create an EPUBOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.EPUBOutputOptions.- Type
- Promise.<Core.PDFNet.Convert.EPUBOutputOptions>
-
<static> createHTMLOutputOptions()
-
Method to create an HTMLOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.HTMLOutputOptions.- Type
- Promise.<Core.PDFNet.Convert.HTMLOutputOptions>
-
<static> createOfficeToPDFOptions( [json])
-
Method to create an OfficeToPDFOptions object
Parameters:
Name Type Argument Description json
string <optional>
options in JSON format. Returns:
A promise that resolves to a PDFNet.Convert.OfficeToPDFOptions.- Type
- Promise.<Core.PDFNet.Convert.OfficeToPDFOptions>
-
<static> createReflow(in_page, json_zones)
-
Parameters:
Name Type Description in_page
Core.PDFNet.Page json_zones
string Returns:
A promise that resolves to an object of type: "PDFNet.Reflow"- Type
- Promise.<Core.PDFNet.Reflow>
-
<static> createSVGOutputOptions()
-
Method to create an SVGOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.SVGOutputOptions.- Type
- Promise.<Core.PDFNet.Convert.SVGOutputOptions>
-
<static> createTiffOutputOptions()
-
Method to create an TiffOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.TiffOutputOptions.- Type
- Promise.<Core.PDFNet.Convert.TiffOutputOptions>
-
<static> createXODOutputOptions()
-
Method to create an XODOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.XODOutputOptions.- Type
- Promise.<Core.PDFNet.Convert.XODOutputOptions>
-
<static> createXPSOutputOptions()
-
Method to create an XPSOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.XPSOutputOptions.- Type
- Promise.<Core.PDFNet.Convert.XPSOutputOptions>
-
<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
Core.PDFNet.Obj | Core.PDFNet.Convert.TiffOutputOptions <optional>
the conversion options Returns:
A promise that resolves to the TIFF file in an buffer- Type
- Promise.<Uint8Array>
-
<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
Core.PDFNet.Obj | Core.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> 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
Core.PDFNet.Obj | Core.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> 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
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDFDoc to append to fileData
ArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the buffer containing the plain text document to convert options
Core.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
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDFDoc to append to in_data
Core.PDFNet.Filter the source TIFF data. 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
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.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 Description input
string | ArrayBuffer Either a url from which to download the file or an ArrayBuffer containing the file data. options
object An object containing conversion options Returns:
A promise that resolves to a "PDFDoc".- Type
- Promise.<Core.PDFNet.PDFDoc>
-
<static> officeToPdfWithFilter(in_pdfdoc, 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_pdfdoc
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the conversion result will be appended to this pdf. in_stream
Core.PDFNet.Filter the source document data. options
Core.PDFNet.Obj | Core.PDFNet.Convert.ConversionOptions <optional>
the conversion options - See:
-
- ConversionOptions
- StreamingPDFConversion() if you would like more control over the conversion process
Throws:
PDFNetExceptionReturns:
- Type
- Promise.<void>
-
<static> pageToHtml(page)
-
Convert a page to HTML and return a string of the html
Parameters:
Name Type Description page
Core.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
Core.PDFNet.Page json_zones
string Returns:
A promise that resolves to an object of type: "string"- Type
- Promise.<string>
-
<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
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.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> toTiffBuffer(in_pdfdoc [, options])
-
Convert the PDF to multipage TIFF
Parameters:
Name Type Argument Description in_pdfdoc
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDF doc to convert to multipage options
Core.PDFNet.Obj | Core.PDFNet.Convert.TiffOutputOptions <optional>
the conversion options Returns:
A promise that resolves to the TIFF file in an buffer- Type
- Promise.<Uint8Array>
-
<static> toXodBuffer(in_pdfdoc [, options])
-
Convert the input file to XOD format and save to a buffer
Parameters:
Name Type Argument Description in_pdfdoc
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDFDoc to convert to XOD options
Core.PDFNet.Obj | Core.PDFNet.Convert.XODOutputOptions <optional>
the conversion options Returns:
A promise that resolves to the XOD file in a buffer- Type
- Promise.<Uint8Array>
-
<static> toXpsBuffer(in_pdfdoc [, options])
-
Convert the PDFDoc to XPS and save to a buffer
Parameters:
Name Type Argument Description in_pdfdoc
Core.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDFDoc to convert to XPS options
Core.PDFNet.Obj | Core.PDFNet.Convert.XPSOutputOptions <optional>
the conversion Returns:
A promise that resolves to the XPS file in a buffer- Type
- Promise.<Uint8Array>