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
- CADConvertOptions
- ConversionOptions
- EPUBOutputOptions
- HTMLOutputOptions
- OfficeToPDFOptions
- TiffOutputOptions
- XODOutputOptions
- XPSOutputCommonOptions
- XPSOutputOptions
Members
-
<static> AnnotationOutputFlag
-
Properties:
Name Type Description e_internal_xfdfnumber include the annotation file in the XOD output. This is the default option e_external_xfdfnumber output the annotation file externally to the same output path with extension .xfdf. This is not available when using streaming conversion e_flattennumber flatten all annotations that are not link annotations -
<static> FlattenFlag
-
Properties:
Name Type Description e_offnumber Disable flattening and convert all content as is. e_simplenumber Feature reduce PDF to a simple two layer representation consisting of a single background RGB image and a simple top text layer. e_fastnumber 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_qualitynumber 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
-
Properties:
Name Type Description e_very_strictnumber Render (flatten) any text that is clipped or occluded. e_strictnumber Render text that are marginally clipped or occluded. e_defaultnumber Render text that are somewhat clipped or occluded. e_keep_mostnumber Only render text that are seriously clipped or occluded. e_keep_allnumber Only render text that are completely occluded, or used as a clipping path. -
<static> OverprintPreviewMode
-
Properties:
Name Type Description e_op_offnumber e_op_onnumber e_op_pdfx_onnumber -
<static> PrinterMode
-
Properties:
Name Type Description e_autonumber e_interop_onlynumber e_printer_onlynumber e_prefer_builtin_converternumber
Methods
-
<static> createCADConvertOptions()
-
Method to create a CADConvertOptions object
Returns:
A promise that resolves to a PDFNet.Convert.CADConvertOptions.- Type
- Promise.<Core.PDFNet.Convert.CADConvertOptions>
-
<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 a OfficeToPDFOptions object.
Parameters:
Name Type Description JSONstring data containing options values for OfficeToPDFOptions. 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_pageCore.PDFNet.Page json_zonesstring Returns:
A promise that resolves to an object of type: "PDFNet.Reflow"- Type
- Promise.<Core.PDFNet.Reflow>
-
<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 fileDataArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray buffer containing the file to convert to multipage TIFF fileTypestring the filename extension of the file. optionsCore.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> fileToTiffWithFilterWithBuffer(in_filename [, options])
-
Convert a file to multipage TIFF and write to the provided filter
Parameters:
Name Type Argument Description in_filenameArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the file to convert to multipage TIFF optionsCore.PDFNet.Obj | Core.PDFNet.Convert.TiffOutputOptions <optional>
the conversion options - See:
-
- TiffOutputOptions
Returns:
A promise that resolves to an object of type: "PDFNet.Filter"- Type
- Promise.<Core.PDFNet.Filter>
-
<static> fileToXodWithBuffer(fileData, fileType [, options])
-
Convert the input file to XOD format and save to a buffer
Parameters:
Name Type Argument Description fileDataArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the file to convert to XOD fileTypestring the filename extension of the file. optionsCore.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 fileDataArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the file to convert to XPS fileTypestring the filename extension of the file. optionsCore.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_pdfdocCore.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDFDoc to append to fileDataArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the buffer containing the plain text document to convert optionsCore.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_pdfdocCore.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDFDoc to append to in_dataCore.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_pdfdocCore.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDFDoc to append to bufArrayBuffer | 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 inputstring | ArrayBuffer Either a url from which to download the file or an ArrayBuffer containing the file data. optionsobject 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_pdfdocCore.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the conversion result will be appended to this pdf. in_streamCore.PDFNet.Filter the source document data. optionsCore.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 pageCore.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 pageCore.PDFNet.Page json_zonesstring 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_pdfdocCore.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. fileDataArrayBuffer | Int8Array | Uint8Array | Uint8ClampedArray the buffer containing the document to be converted to pdf fileTypestring 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_pdfdocCore.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDF doc to convert to multipage optionsCore.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> toTiffWithFilter(in_pdfdoc [, options])
-
Convert the PDF to multipage TIFF and write to the provided filter
Parameters:
Name Type Argument Description in_pdfdocCore.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDF doc to convert to multipage TIFF optionsCore.PDFNet.Obj | Core.PDFNet.Convert.TiffOutputOptions <optional>
the conversion options - See:
-
- TiffOutputOptions
Returns:
A promise that resolves to an object of type: "PDFNet.Filter"- Type
- Promise.<Core.PDFNet.Filter>
-
<static> toXodBuffer(in_pdfdoc [, options])
-
Convert the input file to XOD format and save to a buffer
Parameters:
Name Type Argument Description in_pdfdocCore.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDFDoc to convert to XOD optionsCore.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_pdfdocCore.PDFNet.PDFDoc | Core.PDFNet.SDFDoc | Core.PDFNet.FDFDoc the PDFDoc to convert to XPS optionsCore.PDFNet.Obj | Core.PDFNet.Convert.XPSOutputOptions <optional>
the conversion Returns:
A promise that resolves to the XPS file in a buffer- Type
- Promise.<Uint8Array>