# PdfExport

## Content

# Namespace: PdfExport

## Table of contents

### Type aliases

- [CheckCancelCallback](PdfExport#checkcancelcallback)
- [DocumentSecurity](PdfExport#documentsecurity)
- [OnProgressCallback](PdfExport#onprogresscallback)
- [PdfExportResult](PdfExport#pdfexportresult)
- [PdfFontDescriptor](PdfExport#pdffontdescriptor)
- [PdfSettings](PdfExport#pdfsettings)
- [PdfSettingsInfo](PdfExport#pdfsettingsinfo)
- [PdfVersion](PdfExport#pdfversion)
- [Permissions](PdfExport#permissions)

### Functions

- [exportDocument](PdfExport#exportdocument)
- [registerPdfFont](PdfExport#registerpdffont)

## 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="documentsecurity" name="documentsecurity"></a> DocumentSecurity

Ƭ **DocumentSecurity**: `Object`

Defines document security settings.

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `ownerPassword?` | `string` | Protects a document from printing or modifying, see [Permissions](PdfExport#permissions). |
| `permissions?` | [`Permissions`](PdfExport#permissions) | The document permissions. |
| `userPassword?` | `string` | Encrypts a document with a password. |

___

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

___

### <a id="pdfexportresult" name="pdfexportresult"></a> PdfExportResult

Ƭ **PdfExportResult**: `Object`

Export result.

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `data` | `Blob` | Result content. |
| `download` | (`filename?`: `string`) => `void` | Triggers browser download of file with export result. |

___

### <a id="pdffontdescriptor" name="pdffontdescriptor"></a> PdfFontDescriptor

Ƭ **PdfFontDescriptor**: `Object`

Defines descriptor of font.

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `name` | `string` | Font name. |
| `postscriptName?` | `string` | The font postscript name. |
| `source` | `string` \| `string`[] | The source of the font. |
| `style?` | `string` | The font style. |
| `useAsDefault?` | `boolean` | True - to use the font as default font. |
| `weight?` | `string` | The font weight. |

___

### <a id="pdfsettings" name="pdfsettings"></a> PdfSettings

Ƭ **PdfSettings**: `Object`

Defines PDF export settings.

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `autoPrint?` | `boolean` | Prints a document on opening the file. |
| `fonts?` | [`PdfFontDescriptor`](PdfExport#pdffontdescriptor)[] | Available *.ttf font files. |
| `info?` | [`PdfSettingsInfo`](PdfExport#pdfsettingsinfo) | Document metadata. |
| `pdfVersion?` | [`PdfVersion`](PdfExport#pdfversion) | PDF Version. |
| `security?` | [`DocumentSecurity`](PdfExport#documentsecurity) | Document security settings. |

___

### <a id="pdfsettingsinfo" name="pdfsettingsinfo"></a> PdfSettingsInfo

Ƭ **PdfSettingsInfo**: `Object`

Defines PDF metadata.

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `author?` | `string` | Author |
| `keywords?` | `string` | keywords |
| `subject?` | `string` | Subject |
| `title?` | `string` | Title |

___

### <a id="pdfversion" name="pdfversion"></a> PdfVersion

Ƭ **PdfVersion**: ``"1.3"`` \| ``"1.4"`` \| ``"1.5"`` \| ``"1.6"`` \| ``"1.7"`` \| ``"1.7ext3"`` \| ``"PDF/A-2b"`` \| ``"PDF/A-3b"``

The version of PDF specification.

___

### <a id="permissions" name="permissions"></a> Permissions

Ƭ **Permissions**: `Object`

Defines PDF permissions.

#### Type declaration

| Name | Type | Description |
| :------ | :------ | :------ |
| `annotating?` | `boolean` | Allows annotating. |
| `contentAccessibility?` | `boolean` | Enables content accessibility. |
| `copying?` | `boolean` | Allows copying. |
| `documentAssembly?` | `boolean` | Allows document assembly. |
| `modifying?` | `boolean` | Allows modifying. |
| `printing?` | ``"lowResolution"`` \| ``"highResolution"`` \| ``"none"`` | Allows printing. |

## Functions

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

▸ **exportDocument**(`source`, `settings?`, `onProgress?`, `checkCancel?`): `Promise`<[`PdfExportResult`](PdfExport#pdfexportresult)\>

Exports a provided PageDocument to the PDF format and returns it as Data URI or Blob.

#### Parameters

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

#### Returns

`Promise`<[`PdfExportResult`](PdfExport#pdfexportresult)\>

___

### <a id="registerpdffont" name="registerpdffont"></a> registerPdfFont

▸ **registerPdfFont**(`fontDescriptor`): `void`

**`deprecated`** Use FontStore.registerFonts instead.

Registers .*ttf fonts to be used in PDF.

#### Parameters

| Name | Type |
| :------ | :------ |
| `fontDescriptor` | [`PdfFontDescriptor`](PdfExport#pdffontdescriptor) |

#### Returns

`void`
