2

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

0

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

The other key is using addImageHtml not addHtml. addHtml uses "HTML Styled Text", not a true HTML renderer. addHtml can reference fonts that are not installed on the machine -- but not using CSS; it does it using its own proprietary tags and attributes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.