Symbol font on ABCpdf

前端 未结 3 387
梦毁少年i
梦毁少年i 2021-01-13 10:33

I\'m using the ABCpdf.net component to convert HTML to PDF. Some of the HTML uses the Symbol font to display certain characters. Unfortunately, we are consuming the HTML fro

相关标签:
3条回答
  • 2021-01-13 11:16

    The WebSuperGoo support team responded with the fix: setting font-related HtmlOptions. I set these options, and it fixed the issue. Yay!

    If you want to embed the fonts used in a web page/HTML you need to use:
        Doc.HtmlOptions.FontEmbed = True
    You may also need to set
        Doc.HtmlOptions.FontSubstitute = False
    and possibly:
        Doc.HtmlOptions.FontProtection = False
    before you use the Doc.AddImageUrl or Doc.AddImageHtml methods.
    

    Edit: As I mention in the comment below, the option that did the trick was FontProtection = false.

    0 讨论(0)
  • 2021-01-13 11:33

    Although I said that the Doc.HtmlOptions was the answer, it turned out that it was something else entirely. The symbols did not show up because the font-weight was not normal (i.e., it was bold). There is no bold subset that contains these characters. IE is smart enough to ignore the bold part, but PDF is rather finicky. It cannot find the character, so it just shows nothing.

    The real solution was to comb through the HTML and ensure that all symbols were surrounded by a span with font-weight: normal !important. It is perhaps a less elegant solution, but it is effective. The only symbol that still randomly refused to show up is the angle symbol (∠). For this, I replaced it with an image. I still can't figure out why it won't appear.

    0 讨论(0)
  • 2021-01-13 11:35

    Try restarting the server.

    I've had a similar issue with fonts on ABCPdf. Although the fonts were clearly installed, for some reason, ABDPdf didn't pick them up until the machine has been restarted.

    There may be some non restart way of achieving the same thing, but that would entail understanding what the problem is! If it's easy, just try restarting.

    0 讨论(0)
提交回复
热议问题