Squared characters issue on wkhtmltopdf

前端 未结 7 1131
猫巷女王i
猫巷女王i 2020-12-14 14:45

I\'ve installed wkhtmltopdf on Centos 5.5. (Since there was library issues, it\'s been 4 days). It\'s partly working now. I said partly because, all pdfs which was created b

7条回答
  •  萌比男神i
    2020-12-14 15:33

    I'm going to guess this is a font issue, or perhaps an encoding issue.

    What encoding does your HTML use? (This is easier to check so I listed it first) If it's something funky, you might have to translate it prior to feeding it to wkhtmltopdf. Reporting a bug might help too in this case.

    Does wkhtmltopdf know how to find your fonts? If wkhtmltopdf can't find your system's fonts, then it's got a serious problem and might fall back on the "Unknown Character" character (the empty box).

    Also, if your text contains characters that don't actually exist in the requested font, you'll get the unknown character character. If you're supposed to be using "Courier New" and the text is all Arabic... the font courier doesn't contain those characters. Browsers have various fall-back positions they can use, but a PDF renderer will just do what it's told to the best of its ability. And in this case, that's the unknown character character.

    Simple Test: can wkhtmltopdf successfully convert a "hello world.html" to PDF on your system?

    Hello World
    

    If that works, you need to figure out where along the line between "brain dead" and "your real html" Things Go Awry.

提交回复
热议问题