Edit this page

Pack Fonts for PDF Export

To provide better quality for the output in PDF, the library needs to have access to the same fonts as the browser uses to display the elements that are produced. Otherwise, neither the layout of the PDF, nor the non-ASCII characters are properly displayed.

To declare the fonts, you need to:

  • Write the appropriate @font-face rules in the CSS.
  • Host the CSS file on the same domain as the page.
  • Keep the font files on the same domain too. Otherwise, you need to make sure that the server, which hosts the fonts, sends the proper HTTP access control (CORS) headers.

Also, when declaring the fonts, it is not possible to serve the page over the file:/// URLs when needed—for example in mobile applications.

Thе @telerik/kendo-pack-fonts module packs one or more fonts into JavaScript code. In this way, you can load that code by using a <script> tag.

The packed code works:

  • Regardless of the location you store it—this means that you do not need CORS headers.
  • Even if the page is loaded to the file:// URL, because you do not need an AJAX request to load the fonts into the Kendo UI PDF library.

For more information, refer to the project on GitHub.

See Also

Other articles and how-to examples on Kendo UI Drawing API:

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy