Export to PDF - overview
CKEditor Cloud Services offer a fast and highly scalable service enabling the user to export documents to PDF document. The feature is available as a service, making it possible to send an HTML string straight into the Cloud Services server for more advanced use or as convenient WYSIWYG editor plugins for the ease of use in less demanding cases.
This is a premium feature. You can purchase a license here or contact us for a tailored offer. Let us know if you have any feedback or questions!
If this feature is used without authentication, the resulting document will be watermarked.
The complementary premium pagination feature for CKEditor 5 allows you to see where page breaks would be after the document is exported to PDF. Thanks to the live preview, the user is able to fine-tune the structure of the output document when editing it. In addition to this, the pagination feature shows you the page count and allows to easily navigate between the document pages.
Merge fields are visually distinct placeholder elements you can put into the content to mark places where real values should be inserted. It is perfect for creating document templates and other kinds of personalized, serialized content. This allows for automation and creating batch output of personalized PDF files. Learn how to configure it in the configuration section of the merge fields guide.
The HTML to PDF converter provides an API for converting HTML documents to PDF files. The service generates a file and returns it to the user so they can save it in the .pdf format on their disk. To integrate the feature into your environment, first check the Quick start guide to start using it.
You can also test the feature using the export to PDF demo page.
The following properties are available while using the converter service:
The html parameter is required to generate a PDF.
HTML content cannot contain the <meta> tag with the refresh document interval.
If you want to use this API directly, you need to provide proper CSS code manually. To achieve this, you should pass a string that is a concatenation of the default editor styles (refer to the CKEditor 5’s content styling guide) and, optionally, your custom styles to the css property. With the default editor configuration, you do not need to specify the config property.
Any HTML compliant content can be sent to the converter.
The API only accepts documents with UTF-8 encoded content for conversion.
- All HTML documents use the
<!DOCTYPE html>declaration to generate PDF files. - The recommended way to generate a PDF document is to send only the HTML content. However, if your document requires a full HTML structure to render properly, you can use it.
This option is used to send custom CSS styles.
Just like the HTML, CSS must be encoded with UTF-8.
If you cannot use UTF-8 and would like to request support for other charsets, please contact us.
The config section defines the details of your PDF conversion request.
Options such as margins, page size, and orientation are available to control the visual arrangement of the document. The implementation of mirror margins facilitates book-like layouts.
You can define headers and footers for the output PDF. The converter supports distinct header and footer variations (first page, odd pages, even pages, and default) to allow for differentiated content across pages.
Beyond content and layout, the configuration allows for control over other PDF attributes. You can set PDF metadata to enhance document discoverability for search and cataloging purposes. Password protection can be applied to restrict file access. You can also include digital signatures to confirm the origin and integrity of the PDF.
Refer to the converter documentation for details on the syntax and usage of all the available options.
Images can be either inserted from a URL or Base64-encoded, using the src attribute of the <img> tag.
To generate PDF documents, you can use web fonts like in a regular browser. You need to specify the URL to the font file or a font file converted to the Base64 format.
Please note that web fonts are not supported in header and footer HTML or styles.
For headers and footers, use one of the default fonts.
Refer to the converter documentation for details and examples.
The Export to PDF CKEditor plugin allows you to easily print the WYSIWYG editor content to a PDF file. When enabled, this feature sends the content of your editor together with the styles that are used to display it to the CKEditor Cloud Services HTML to PDF converter service. The service then generates a PDF document that the user can download.
Thanks to this plugin, it takes exactly one button click to get a PDF file with content formatted the same way as displayed in the CKEditor WYSIWYG editor. An easy solution for integrations, that does not demand editor data to be processed further once it is edited.
Export to PDF is a service that generates PDF files based on the data provided by the customer (HTML, CSS). To perform the conversion, it requires the data sent from the editor or a database, but the service itself is fully stateless.
The data (especially your sensitive data: HTML, CSS, comments) is used only during the processing. However, we store some information needed for billing and maintaining our system. We try to reduce stored data to a required minimum and at this moment we store such information as the number and duration of exports, the final document size, the number of unique exports, statistical data (used features, IP addresses, editor versions).
All logs related to processing requests are saved only in case of unexpected situations and are stored for 90 days. The data in logs includes an error message, stack trace, and information about the request.