PDF Reports

Position the chart as desired, then export it as a high resolution image into a PDF report.

Report template

Page title

Figure caption

PDF is a popular format for creating documents and reports as it's highly customisable and preserves important details.

This demo shows how to use chart.export() to create PDF reports with custom layouts, fonts and embedded KeyLines charts in vector quality.

Tailor-made layouts

Different documents may have different layout or text requirements, which is why the doc option gives you full control over the appearance of the exported PDF.

Passing an instance of PDFDocument to doc allows you to customise the page layout using the methods provided by PDFKit, such as text(), font() and list().

Customised fonts

The fonts option tackles the limited default font support in PDF by letting you embed your own fonts. Optionally, you can also use the specify separate font files for 'regular' and 'bold' versions using the weight property.

To minimise the size of the output file the export will only embed fonts that were used in the exported image.

Before you start

KeyLines uses external dependencies to run PDF export:

See Adding dependencies for more details and guidance.

Note that some viewers and in-browser viewers may not fully support viewing PDF. For example, we do not recommend using Firefox built-in PDF viewer.

Key functions used: