# HtmlExport

## Content

# Namespace: HtmlExport

## Table of contents

### Type aliases

- [CheckCancelCallback](HtmlExport#checkcancelcallback)
- [HtmlExportResult](HtmlExport#htmlexportresult)
- [HtmlSettings](HtmlExport#htmlsettings)
- [OnProgressCallback](HtmlExport#onprogresscallback)

### Functions

- [exportDocument](HtmlExport#exportdocument)

## Type aliases

### <a id="checkcancelcallback" name="checkcancelcallback"></a> CheckCancelCallback

Ƭ **CheckCancelCallback**: () => `boolean`

#### Type declaration

▸ (): `boolean`

Defines a type of callback that gets called to check if cancellation was requested.

##### Returns

`boolean`

___

### <a id="htmlexportresult" name="htmlexportresult"></a> HtmlExportResult

Ƭ **HtmlExportResult**: `Object`

Export result.

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `data` | `Blob` \| `string` | Result content. The content is 'string' if 'multiPage = true', otherwise content is zip blob. |
| `download` | (`filename?`: `string`) => `void` | Triggers browser download of file with export result. |

___

### <a id="htmlsettings" name="htmlsettings"></a> HtmlSettings

Ƭ **HtmlSettings**: `Object`

Defines HTML export settings.

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `autoPrint?` | `boolean` | Set to _true_ to add script for a printing page when it is loaded. |
| `embedImages?` | ``"none"`` \| ``"embed"`` \| ``"external"`` | Embed images into HTML. |
| `multiPage?` | `boolean` | Export each page as separate HTML file. |
| `outputType?` | ``"html"`` \| ``"zip"`` \| ``"auto"`` | Export as ZIP archive with HTML files. |
| `title?` | `string` | A title for an HTML page. |

___

### <a id="onprogresscallback" name="onprogresscallback"></a> OnProgressCallback

Ƭ **OnProgressCallback**: (`pageNumber`: `number`) => `void`

#### Type declaration

▸ (`pageNumber`): `void`

Defines a type of callback that gets called after each page is rendered.

##### Parameters

| Name | Type |
| :------ | :------ |
| `pageNumber` | `number` |

##### Returns

`void`

## Functions

### <a id="exportdocument" name="exportdocument"></a> exportDocument

▸ **exportDocument**(`source`, `settings?`, `onProgress?`, `checkCancel?`): `Promise`<[`HtmlExportResult`](HtmlExport#htmlexportresult)\>

Exports a provided PageDocument to the HTML format and returns it as string or Blob.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `source` | [`PageDocument`](../classes/Core.PageDocument) \| `VDomRenderer` | PageDocument to export. |
| `settings?` | [`HtmlSettings`](HtmlExport#htmlsettings) | Export settings. |
| `onProgress?` | [`OnProgressCallback`](HtmlExport#onprogresscallback) | The callback that gets called after each sheet is rendered. |
| `checkCancel?` | [`CheckCancelCallback`](HtmlExport#checkcancelcallback) | The callback that gets called before sheet rendering, the rendering process will be canceled if the function returns _true_. |

#### Returns

`Promise`<[`HtmlExportResult`](HtmlExport#htmlexportresult)\>
