1
votes

I'm looking for a definitive answer to this question, as I can only find scattered pieces of information.

In our site css we use an embedded webfont using @fontface. When we render a pdf of pages using ABCPDF, the font does not show. We are using both addImageurl to get website pages, and addHtml to add our own personalized front cover.

We are using the msHTML engine.

Has anyone had experience of using non-system/standard fonts, and using embedded web fonts?

Thanks

1

1 Answers

1
votes

ABC doesn't support @fontface.

However you can use custom fonts if you know what the font is beforehand (if the content is from your own server) when using addImageHTML().

All you need to do is install the font on your server (eg here I'm using OpenSans), and then reference it in your CSS like so:

@font-face {
    font-family: 'open_sansregular';
    src: url('../fonts/OpenSans-Regular-webfont.eot');
    src: url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('../fonts/OpenSans-Regular-webfont.woff') format('woff'),
         url('../fonts/OpenSans-Regular-webfont.ttf') format('truetype'),
         url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg');
}

body
{
    font-family: Open Sans, 'open_sansregular', sans-serif;
}

The key here is the:

    font-family: Open Sans 

part. This will try to reference a font named "Open Sans" that is on the local computer than renders the HTML. AbcPDF will pick it up and use it (I've done it myself).