[]
Ƭ CheckCancelCallback: () => boolean
▸ (): boolean
Defines a callback that determines whether export should be canceled.
example
const shouldCancel: CheckCancelCallback = () => false;
boolean
true to cancel the export; otherwise, false.
Ƭ DocumentSecurity: Object
Represents document security settings.
example
const security: DocumentSecurity = {
userPassword: 'secret',
permissions: { printing: 'lowResolution' },
};
| Name | Type | Description |
|---|---|---|
ownerPassword? |
string |
Gets or sets the owner password used to enforce permissions. |
permissions? |
Permissions |
Gets or sets the document permissions. |
userPassword? |
string |
Gets or sets the user password used to open the document. |
Ƭ OnProgressCallback: (pageNumber: number) => void
▸ (pageNumber): void
Defines a callback invoked after each page is rendered.
example
const onProgress: OnProgressCallback = (pageNumber) => console.log(pageNumber);
| Name | Type | Description |
|---|---|---|
pageNumber |
number |
The one-based page number that has finished rendering. |
void
Ƭ PdfExportResult: Object
Represents the result of a PDF export.
example
const result: PdfExportResult = {
data: new Blob(),
download: (name) => console.log(name),
};
| Name | Type | Description |
|---|---|---|
data |
Blob |
Gets or sets the exported content. |
download |
(filename?: string) => void |
Gets or sets the function that triggers a browser download of the export result. example ts const result = {} as PdfExportResult; result.download('report.pdf'); |
Ƭ PdfFontDescriptor: Object
Represents a PDF font descriptor.
example
const font: PdfFontDescriptor = {
name: 'Roboto',
source: '/fonts/roboto.woff2',
weight: '400',
};
| Name | Type | Description |
|---|---|---|
name |
string |
Gets or sets the font name. |
postscriptName? |
string |
Gets or sets the font PostScript name. |
source |
string | string[] |
Gets or sets the font source. |
style? |
string |
Gets or sets the font style. |
useAsDefault? |
boolean |
Gets or sets a value indicating whether this font is the default. |
weight? |
string |
Gets or sets the font weight. |
Ƭ PdfSettings: Object
Represents PDF export settings.
example
const settings: PdfSettings = {
pdfVersion: '1.7',
autoPrint: false,
};
| Name | Type | Description |
|---|---|---|
autoPrint? |
boolean |
Gets or sets whether the document prints on open. |
fonts? |
PdfFontDescriptor[] |
Gets or sets the list of available font descriptors. |
info? |
PdfSettingsInfo |
Gets or sets the document metadata. |
pdfVersion? |
PdfVersion |
Gets or sets the PDF version. |
security? |
DocumentSecurity |
Gets or sets the document security settings. |
Ƭ PdfSettingsInfo: Object
Represents PDF document metadata.
example
const info: PdfSettingsInfo = {
title: 'Invoice',
author: 'Contoso',
};
| Name | Type | Description |
|---|---|---|
author? |
string |
Gets or sets the document author. |
keywords? |
string |
Gets or sets the document keywords. |
subject? |
string |
Gets or sets the document subject. |
title? |
string |
Gets or sets the document title. |
Ƭ PdfVersion: "1.3" | "1.4" | "1.5" | "1.6" | "1.7" | "1.7ext3" | "PDF/A-2b" | "PDF/A-3b"
Represents the PDF specification version to use for export.
remarks
Accepted values:
'1.3''1.4''1.5''1.6''1.7''1.7ext3''PDF/A-2b''PDF/A-3b'example
const version: PdfVersion = '1.7';
Ƭ Permissions: Object
Represents PDF permissions.
example
const permissions: Permissions = {
printing: 'highResolution',
copying: true,
};
| Name | Type | Description |
|---|---|---|
annotating? |
boolean |
Gets or sets whether annotations are allowed. |
contentAccessibility? |
boolean |
Gets or sets whether content accessibility is enabled. |
copying? |
boolean |
Gets or sets whether copying is allowed. |
documentAssembly? |
boolean |
Gets or sets whether document assembly is allowed. |
modifying? |
boolean |
Gets or sets whether document modification is allowed. |
printing? |
"lowResolution" | "highResolution" | "none" |
Gets or sets the printing permission. remarks Accepted values: - 'lowResolution' - 'highResolution' - 'none' |
▸ exportDocument(source, settings?, onProgress?, checkCancel?): Promise<PdfExportResult>
Exports a PageDocument or VDomRenderer to PDF.
example
const result = await exportDocument(report, { pdfVersion: '1.7' });
result.download('report.pdf');
| Name | Type | Description |
|---|---|---|
source |
PageDocument | VDomRenderer |
The source document or renderer to export. |
settings? |
PdfSettings |
The PDF export settings. |
onProgress? |
OnProgressCallback |
The callback invoked after each page is rendered. |
checkCancel? |
CheckCancelCallback |
The callback invoked before rendering each page. Return true to cancel. |
Promise<PdfExportResult>
A promise that resolves to the export result.