PDF Drawing requires Dejavu font

2 posts, 0 answers
  1. Bob
    Bob avatar
    3 posts
    Member since:
    Feb 2014

    Posted 14 Mar Link to this post

    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!

  2. Mihai
    Admin
    Mihai avatar
    153 posts

    Posted 15 Mar Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top