0

I'm using the ABCPDF plugin to generate PDFs and I have declared a font directly within my HTML/CSS

                        @font-face{
                    font-family: FREE3OF9;
                    src: url('http://**myurl**/fonts/FREE3OF9.otf') format("opentype");
                    }

                    .barcodeStyle{
                    font-family:FREE3OF9;
                    font-size:40px;
                    text-align:center;
                    border:1px solid black;
                    padding:5px;
                    }

However it doesn't appear the font is getting picked up when the HTML is added to the document. Is there something else I need to do? I've verified the font path by rendering this in the browser which works correctly.

Sami.C
  • 561
  • 1
  • 11
  • 24
  • Try actually adding font, instead of URL reference: http://www.websupergoo.com/helppdf/source/5-object_reference/doc/1-methods/addfont.htm – Justinas Jan 23 '17 at 07:52
  • @Justinas do I still need to keep my CSS class and assign to html? The example above looks to be only applicable if you are adding the content directly from the ASP. Unfortunately I only want one specific div within my HTML contents to use this font. – Sami.C Jan 23 '17 at 23:53
  • Usually if you wish to use some font, even if for single letter, you need to tell PDF library, that "this is the font and save it for later". – Justinas Jan 24 '17 at 06:30
  • Can you please confirm how this is done with a code sample? – Sami.C Jan 24 '17 at 07:10

1 Answers1

1

Web fonts are supported by the new ABCChrome HTML engine in ABCpdf 11. You can convert a URL (including a "file://" URI) using Doc.AddImageUrl, or an HTML string with Doc.AddImageHtml. And the Paged HTML Example applies for HTML that may take up more than one PDF page.

If there is any latency/delay in accessing web fonts, you can make ABCpdf wait e.g.

    doc.HtmlOptions.RepaintDelay = 2000;
    doc.HtmlOptions.RepaintTimeout = 5000; // default
    int htmlID = doc.AddImageUrl(theURL);
overprint
  • 31
  • 1
  • 4