Last updated

API / geotoolkit / pdf / PdfExport / PdfExport

Class: PdfExport

pdf.PdfExport.PdfExport

Utility class to export node

Table of contents

Constructors
Methods

Contents

Constructors

new PdfExport()

new PdfExport()

Methods

documentExportToPdf

documentExportToPdf(document, printSettings): string | Uint8Array

Export document to PDF

Throws

if memory is not enough

Parameters

Name Type Description
documentDocumentdocument to be exported
printSettingsDocumentExportSettingsinfo about print settings

Returns

string | Uint8Array

PDF in string


documentExportToPdfStream

documentExportToPdfStream(document, printSettings, pdfStream?): IWritable

Export document to PDF stream

Throws

if memory is not enough

Parameters

Name Type Description
documentDocumentdocument to export
printSettingsDocumentExportSettingsinfo about print settings
Optional pdfStreamIWritableoutput stream for pdf

Returns

IWritable

PDF stream


documentExportToPdfStreamAsync

documentExportToPdfStreamAsync(document, printSettings, pdfStream?, progress?): Promise<IWritable>

Export document to PDF stream asynchronously

Parameters

Name Type Description
documentDocumentdocument to export
printSettingsDocumentExportSettingsinfo about print settings
Optional pdfStreamIWritableoutput stream for pdf
Optional progress(currentPage: number, totalPages: number) => void

Returns

Promise<IWritable>


embedFont

embedFont(subType, fontName, fontWeight, fontStyle, fontBase64EncodedFile, encoding): void

Embeds font into PDF

Parameters

Name Type Description
subTypeFontSubTypesub type
fontNamestringfont name
fontWeightstringfont weight
fontStylestringfont style
fontBase64EncodedFilestringbase64 encoded True Type Font file (TTF)
encodingstringencoding Identity-H

Returns

void


exportToPdf

exportToPdf(root, imageWidth, imageHeight, modelLimits): IWritable

Export group to PDF

Throws

if memory is not enough

Parameters

Name Type Description
rootGroup<Node>root node to be used for export.
imageWidthnumberimage width(Optional)
imageHeightnumberimage height (Optional)
modelLimitsRectmodellimits (Optional)

Returns

IWritable

PDF Content


getStreamCompression

getStreamCompression(): boolean

Return status of stream compression if it is enable or disable

Returns

boolean


setImageCompression

setImageCompression(method, quality?, speed?): PdfExport

set image compression settings for the pdf export. right now three methods are available ImageCompression, if you select the PNG method, then you could pass a SpeedCompression speed parameter if you select the JPEG method, then you could pass a number ranged from 0 to 1 to specify the quality of the image if you select the NONE method, all parameters will be ignored. WARNING! if you select the NONE method and memory is not enough, the PNG method will be selected

Parameters

Name Type Description
methodImageCompressionmethod
Optional qualitynumberlevel of quality
Optional speedSpeedCompressioncompression speed

Returns

PdfExport


setStreamCompression

setStreamCompression(enable): PdfExport

Enable or disable stream compression. By default it is enable

Parameters

Name Type Description
enablebooleanenable or disable image compression

Returns

PdfExport


enableClipping

Static enableClipping(textClippingEnabled, imageClippingEnabled): void

Static method to Enable/Disable Text and Image Clipping in Pdf

Parameters

Name Type Description
textClippingEnabledbooleanText Shape Clipping (default: true)
imageClippingEnabledbooleanImage Shape Clipping (default: true)

Returns

void


isSupported

Static isSupported(): boolean

Returns true if exporting a PDF is supported by this browser

Returns

boolean


setMaximumImageSize

Static setMaximumImageSize(maximumImageSize): void

Sets maximum image size (in bytes)

Parameters

Name Type Description
maximumImageSizenumberimage size for forced selecting PNG compression method

Returns

void