Class: Convert

PDFNet. Convert


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

OfficeToPDFOptions
TiffOutputOptions
XODOutputOptions
XPSOutputCommonOptions
XPSOutputOptions

Members


<static> AnnotationOutputFlag

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

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

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

Properties:
Name Type Description
e_op_off number
e_op_on number
e_op_pdfx_on number

<static> PrinterMode

Properties:
Name Type Description
e_auto number
e_interop_only number
e_printer_only number
e_prefer_builtin_converter number

Methods


<static> createOfficeToPDFOptions()

Method to create an OfficeToPDFOptions object
Returns:
A promise that resolves to a PDFNet.Convert.OfficeToPDFOptions.
Type
Promise.<PDFNet.Convert.OfficeToPDFOptions>

<static> createTiffOutputOptions()

Method to create an TiffOutputOptions object
Returns:
A promise that resolves to a PDFNet.Convert.TiffOutputOptions.
Type
Promise.<PDFNet.Convert.TiffOutputOptions>

<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> 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> fromTiff(in_pdfdoc, in_data)

Parameters:
Name Type Description
in_pdfdoc PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc
in_data PDFNet.Filter
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 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.<PDFNet.PDFDoc>

<static> officeToPdfWithFilter(in_pdfdoc, in_stream [, options])

Parameters:
Name Type Argument Description
in_pdfdoc PDFNet.PDFDoc | PDFNet.SDFDoc | PDFNet.FDFDoc
in_stream PDFNet.Filter
options PDFNet.Obj | PDFNet.Convert.ConversionOptions <optional>
Returns:
Type
Promise.<void>

<static> pageToHtml(page)

Parameters:
Name Type Description
page PDFNet.Page
Returns:
A promise that resolves to an object of type: "string"
Type
Promise.<string>

<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
  • 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, .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
  • 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
  • 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, .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
  • ConversionOptions
Returns:
A promise that resolves to a DocumentConversion object which encapsulates this particular conversion.
Type
Promise.<PDFNet.DocumentConversion>

<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>