# ExportPdfConfig

interface

The configuration of the export to PDF feature. It is used by the PDF export features from the `@ckeditor/ckeditor5-export-pdf` package.

```typescript
ClassicEditor
	.create( {
		exportPdf: ... // Export to PDF feature options.
	} )
	.then( ... )
	.catch( ... );
```

See [all editor options](module_core_editor_editorconfig-EditorConfig.md).

<a id="properties">

## Properties

<a id="member-appID">

### `appID?: string`

The application unique identifier.

<a id="member-converterOptions">

### `converterOptions?: ExportPdfConverterOptions | ExportPdfConverterOptionsV2`

The HTML to PDF converter options.

**NOTE:** Configuring the plugin is not mandatory but it is highly recommended, especially if you want to get the most accurate results when generating the PDF file. To learn more, please check the [HTML to PDF converter configuration](https://pdf-converter.cke-cs.com/v2/convert/docs).

```typescript
const exportPdfConfig = {
	converterOptions: {
		...
	}
}
```

Defaults to `` `{ document: { size: 'A4', orientation: 'portrait', margins: { top: '0mm', bottom: '0mm', right: '0mm', left: '0mm' } }, rendering: { wait_for_network: true, wait_time: 0 } }` ``

<a id="member-converterUrl">

### `converterUrl?: string`

A URL to the HTML to PDF converter.

```typescript
const exportPdfConfig = {
	converterUrl: 'https://myconverter.com/v1/'
}
```

**NOTE:** The plugin uses the default HTML to PDF converter delivered by CKEditor Cloud Services. You can provide a URL to an on-premises converter instead.

Defaults to `'https://pdf-converter.cke-cs.com/v2/convert/html-pdf'`

<a id="member-dataCallback">

### `dataCallback?: ( editor: Editor ) => string`

A function to gather the HTML to be converted to PDF.

**NOTE:** This option may be useful when the editor does not have `getData()` method, or if the HTML to be converted should be different than the edited one.

```typescript
const exportPdfConfig = {
	dataCallback: ( editor: Editor ) => {
		return `
			<header id="header">${ editor.data.get( { rootName: 'header' } ) }</header>
			<div id="content">${ editor.data.get( { rootName: 'content' } ) }</div>
		`;
	}
}
```

Defaults to `` `( editor: Editor ) => editor.getData()` ``

<a id="member-fileName">

### `fileName?: string | () => string`

The name of the generated PDF file.

```typescript
// Static file name.
const exportPdfConfig = {
	fileName: 'my-document.pdf'
}

// Dynamic file name.
const exportPdfConfig = {
	fileName: () => {
		const articleTitle = document.querySelector( '#title' );

		return `${ articleTitle.value }.pdf`;
	}
}
```

**NOTE:** The file name must contain the `.pdf` extension. Otherwise your operating system or device may have trouble identifying the file type.

Defaults to `'document.pdf'`

<a id="member-stylesheets">

### `stylesheets?: Array<string>`

Paths to the `.css` files containing additional styling for the editor's content (**the order of provided items matters**).

```typescript
const exportPdfConfig = {
	stylesheets: [ './path/to/custom-style.css' ]
}
```

**NOTE:** If `stylesheets` are not provided, the plugin will sent only [the default editor content styles](../getting-started/setup/content-styles.md) to the converter.

**Default editor's content styles**: [The default editor content styles](../getting-started/setup/content-styles.md) are applied to the generated PDF thanks to the `'EDITOR_STYLES'` token, which is provided to the `stylesheets` by default. If you don't want them to be applied, you have to omit the token:

**NOTE:** The `'EDITOR_STYLES'` string is only supported in legacy custom builds with webpack or DLLs. In other setups you always need to pass the stylesheets.

```typescript
const exportPdfConfig = {
	stylesheets: [ './path/to/custom-editor-styles.css' ]
}
```

**Web fonts:** If you want to [use web fonts](../features/converters/export-pdf.md#providing-web-font-styles) in your PDF document, you should provide a path to the file containing the web font declaration before the `'EDITOR_STYLES'` token and other style sheets:

```typescript
const exportPdfConfig = {
	stylesheets: [
		'./path/to/fonts.css'
		'./path/to/editor-styles.css',
	]
}
```

**Web fonts and custom styling:** For more advanced styling, your configuration should look like this:

```typescript
const exportPdfConfig = {
	stylesheets: [
		'./path/to/fonts.css',
		'./path/to/editor-styles.css',
		'./path/to/custom-styles.css'
	]
}
```

Defaults to `` `[ 'EDITOR_STYLES' ]` ``

<a id="member-token">

### `token?: InitializedToken`

The authentication token.

See: [`token`](module_cloud-services_cloudservices-CloudServices.md#member-token)

<a id="member-tokenUrl">

### `tokenUrl?: false | TokenUrl`

A token URL or a token request function. This field is optional and should be used only when a different `tokenUrl` is required for the export to PDF feature.

**Note:** The token can be disabled with the `false` value provided.

See: [`tokenUrl`](module_cloud-services_cloudservicesconfig-CloudServicesConfig.md#member-tokenUrl)

<a id="member-version">

### `version?: 1 | 2`

The version of the HTML to PDF converter API.

Defaults to `'2'`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
