wkthmltoimage zoom vastly different on different computers (wkhtmltopdf is correct on both)

215 views
Skip to first unread message

KJ Price

unread,
Sep 5, 2014, 11:43:17 AM9/5/14
to wkhtmltop...@googlegroups.com
We use wkhtmltoimage to display the Print version of our website using C# as our backend. On our Stage and Live servers and all of my coworkers' local environments, the dimensions (zoom) are correct; however, on my local environment the zoom is way off and the document is zoomed to around half of what it should be (so that everything on the page is super small).

We are using wkhtmltopdf for the Print Preview on some of our pages and it looks correct no matter where  we are. 

Any idea what would cause the strange issue with wkhtmltoimage on just my machine?

mn4367

unread,
Sep 25, 2014, 5:59:44 AM9/25/14
to wkhtmltop...@googlegroups.com
On Windows the current display settings influence the rendering. So if you have set the DPI of your display to something "non standard", any content will be resized depending on this setting. Assume your display is set to 96dpi on Windows, then if you render the same document on the Mac and on Windows you'd have to use --zoom 1.33 on Windows to get roughly the same dimensions in both PDFs.

Another (seldom) problem are long text lines in code blocks which can't be broken. If there is no opportunity (whitespace) to break such a long line wkhtmltopdf will try to shrink the document so that the complete line can be rendered on the page. You can prevent this by using white-space: pre-wrap; in your CSS for code elements.
Reply all
Reply to author
Forward
0 new messages