Why do wkhtmltopdf.exe produce different results on different Windows machines?

smerlung picture smerlung · Jun 3, 2014 · Viewed 7.9k times · Source

I have a simple test.html file:

<html>
<div style="width: 100%; font-size: 28pt;">
This is a test to see what happens when this kind of text gets processed by wkhtmltopdf
</div>
</html>

Which I run through wkhtmltopdf.exe like this:

wkhtmltopdf.exe test.html test.pdf

On one machine I get the following result:

But on another machine I get this result:

It looks like the font size is different?

Why is this happening?

Thanks.

EDIT

I found out what causes this. Windows has a setting for changing the text size:

For some reason the default on one computer is 100% and on the other it is 125%. Are there any way to ignore this in webkit?

Answer

smerlung picture smerlung · Jun 4, 2014

As I have written in the original post, the root cause of the problem is that wkhtmltopdf is affected by text size setting in windows. So in my case the two different computers has two different windows text size settings. Hopefully this information can be usefull to someone.

EDIT

It has been a while, but if anyone is interested this is how I ended up solving the problem. I used the argument:

--dpi 125

125 is not a magic number it just ended producing the best visual result in my case. I didn't have a lot of time to look into this, but it solved the problem, and now every windows machine produce the same result.

As a note --zoom argument didn't solve the discrepancy between windows machines.