mileszs / wicked_pdf

PDF generator (from HTML) plugin for Ruby on Rails
http://www.mileszs.com/wicked-pdf-plugin
MIT License
3.54k stars 647 forks source link

Page height does not match CSS height #786

Open dcporter44 opened 5 years ago

dcporter44 commented 5 years ago

I have a CSS HTML page that I'm trying to covert to pdf. The body of the HTML is set to height: 11in;. It appears correctly in the browser. However, if I set the wicked_pdf page height to "Letter" size (11inch height), the page overflows onto a second page by about 0.1 inches. Why wouldn't these heights match up? How can I fix this?

dcporter44 commented 5 years ago

FYI I have 0 margin, so that's not the problem

dcporter44 commented 5 years ago

Another detail I just noticed. If I set the zoom to 0.977 it fits perfectly. But seems very strange I have to do this.

unixmonkey commented 5 years ago

Because wkhtmltopdf depends on the system's rendering engines to produce it's output, a number of system factors can influence it's size and rendering characteristics. If you want precise output, you may need to control for some of these factors.

Here's an issue with some related information: https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1782