[]
Ƭ 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.
Ƭ HtmlExportResult: Object
Represents the result of an HTML export.
example
const result: HtmlExportResult = {
data: '<html></html>',
download: (name) => console.log(name),
};
| Name | Type | Description |
|---|---|---|
data |
Blob | string |
Gets or sets the exported content. remarks Returns a string for single HTML output and a Blob for ZIP output. |
download |
(filename?: string) => void |
Gets or sets the function that triggers a browser download of the export result. example ts const result = {} as HtmlExportResult; result.download('report.html'); |
Ƭ HtmlSettings: Object
Represents HTML export settings.
example
const settings: HtmlSettings = {
outputType: 'html',
title: 'Invoice',
};
| Name | Type | Description |
|---|---|---|
autoPrint? |
boolean |
Gets or sets whether an auto-print script is added on page load. |
embedFonts? |
boolean |
Gets or sets whether fonts are embedded in the exported HTML. remarks Requires outputType to be 'zip'. |
embedImages? |
"none" | "embed" | "external" |
Gets or sets how images are embedded in the exported HTML. remarks Accepted values: - 'none': Do not embed images. - 'embed': Embed images as data URIs. - 'external': Store images as external files in the archive. Using 'external' requires outputType to be 'zip'. |
multiPage? |
boolean |
Gets or sets whether each page is exported as a separate HTML file. remarks Requires outputType to be 'zip'. |
outputType? |
"html" | "zip" | "auto" |
Gets or sets the output format. remarks Accepted values: - 'html': Export a single HTML file. - 'zip': Export a ZIP archive. - 'auto': Choose automatically based on other settings. |
title? |
string |
Gets or sets the title of the HTML page. remarks This value maps to the <title> element in the HTML output. |
Ƭ 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
▸ exportDocument(source, settings?, onProgress?, checkCancel?): Promise<HtmlExportResult>
Exports a PageDocument or VDomRenderer to HTML.
example
const result = await exportDocument(report, { outputType: 'html', title: 'Report' });
result.download('report.html');
| Name | Type | Description |
|---|---|---|
source |
PageDocument | VDomRenderer |
The source document or renderer to export. |
settings? |
HtmlSettings |
The HTML 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<HtmlExportResult>
A promise that resolves to the export result.