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-facerules 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.
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.