2

i now that my question is many times to find in stackoverflow, but nothing solves my problem. im on a server with centOS running. I created a website which generates a pdf using wkhtmltopdf from command line. I set up this page on a dev server with ubuntu to, and there i have no problems. The thing is: i want to use the font arial in my pdf. I tried all the thins which are described here or in other forums, but nothing helps me.

I read that wkhtmltopdf per default uses the font dejavu. I discovered that the centOS has this font not in /usr/share/fonts/ there is only /usr/share/fonts/msttcore with some fonts in this.

So, one of the fonts in there is the arial. so i tried to make a font-face this way:

    @font-face {
 font-family: "arialregular";
 src: url(file:///usr/share/fonts/msttcore/arial.ttf) format("truetype");
  font-weight: normal;
  font-style: normal;
}

And in my stylesheet then i use

font-family: 'arialregular';

But the font in the pdf looks very shitty. There are big gaps between some letters, or some letters are overlapping.

This font is so shitty too if i dont use any font-face directive. So i think there is something wrong with the fonts on the centOS installation. Maybe its not. I dont know.

If someone could help or see a posibillity to get this running correctly, please answer.

And sorry for maybe duplicating again this issue. Thanks

Maik Hagenbruch
  • 83
  • 1
  • 13
  • Same problem here. Though all fonts seem to be installed on the server and the current version of wkhtmltopdf is used. Did you find a solution @Maik Hagenbruch? – webDEVILopers Feb 10 '18 at 10:44
  • https://stackoverflow.com/questions/10611828/use-custom-fonts-with-wkhtmltopdf – eric Nov 28 '18 at 06:51
  • 2
    Not a solution but this might help,from https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1687 I was experiencing this behaviour when I developed on Windows and the production app ran on Ubuntu. On Windows font sizes were normal, but on Ubuntu they were too big. To solve this I switched from woff fonts to ttf and updated wkhtmltopdf from 0.12.3 to 0.12.4. Now it looks almost exactly the same in both environments. – zardilior Jan 17 '19 at 16:01

0 Answers0