Question

Using "wkhtmltopdf" as a PDF generator, and CKeditor as a Wysiwig editor, the font-size looks different between what I see in my browser, and what is shown in the PDF.

I tried many things: changing the font-size to cm/px/pt, changing the font-size percentage on the body ... but I can't find a way to have the same look in my HTML editor and in my PDF.

Is there some kind of link between PDF font-size and html one's ? Is the output in a PDF smaller than the one in a browser ? Does someone already managed to obtain the same look in a WebBrowser than in a PDF using those kind of PDF generation tool ?

Was it helpful?

Solution

I found a satisfying solution.

I tried to import font using @font-face, but this doesn't work for me, because multiple @font-face for each "style" (italic, bold, bold+italic) was not recognized by wkhtmltopdf. I had to use a "free" font ("DejaVu Sans" in my case) that was available on my Windows system and on the Linux Server and is directly available by the system when it generates the PDF.

Those two fonts now renders similarly between my Wisywig and the PDF generated. I also had to use a lot of CSS rules to make it clean, removing PNG images ... but that's another story.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top