This is a migrated thread and some comments may be shown as answers.

PDF Drawing requires Dejavu font

1 Answer 390 Views
Drawing API
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 14 Mar 2016, 01:44 PM

I'm exporting HTML to PDF using the kendo.drawing.drawDOM function. It works well except it seems to require the DejaVu font, which I'm not using (I'm using my own fonts).

This leads to 404's in my production environment, where we do not have (or want) these fonts (css/fonts/DejaVu/DejaVuSerif.ttf). The export fails there.

Is there any way using the API to remove this dependency? I've been playing with the kendo.pdf.defineFont method, but I'm not sure if it can be uses to replace or remove Dejavu!

1 Answer, 1 is accepted

Sort by
0
Mihai
Telerik team
answered on 15 Mar 2016, 09:41 AM
Hi Bob,

The PDF library defaults to one of the DejaVu fonts when a required font is not available.  For example, if you want to use font-face: Arial on some element, in order to make sure it looks properly in PDF, your CSS should also contain a declaration like this:

    @font-face {
      font-family: Arial;
      src: url("/path/to/arial.ttf") format("truetype");
    }

(and you will need @font-face declarations for bold / italic / bold+italic as well, if you use those variants).

Lacking such declarations, our library will attempt to use DejaVu Sans.

The DejaVu fonts are distributed with Kendo, and declared with @font-face in the Kendo CSS, and assuming you did not delete them or changed the directory structure, they should not 404.  The decision to use them by default was so that we can display Unicode characters out-of-the-box.

If all elements to be displayed in PDF use a font of your own and if that font is declared with @font-face then no request to DejaVu fonts should happen.

You can read more about fonts in PDF in our documentation.

Regards,
Mihai
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Drawing API
Asked by
Bob
Top achievements
Rank 1
Answers by
Mihai
Telerik team
Share this question
or