My headers often clip content so that the content below it is not completely visible, it appears as though the page continues underneath the header before the header ends and as a result, not all of the content is shown.
Is there a CSS rule I can use for this? Or a cmd argument for wkhtmltopdf? Or any other way?
I have learned that this is actually a known issue and is unlikely to be changed in a while. The workaround is to use style="margin:0; padding:0;"
in the header <body>
element. Another workaround would be to experiment with the --header-spacing n
parameter. Yet another way is to wrap all top-page elements and add margin there, but that is a very bad an non-dynamic idea.
For for further information see:
http://code.google.com/p/wkhtmltopdf/issues/detail?id=182 (duplicate of this issue) http://code.google.com/p/wkhtmltopdf/issues/detail?id=175 (the origins of this issue) http://code.google.com/p/wkhtmltopdf/issues/detail?id=523 (header-spacing workaround)
Worked for me with <body style='height:50px;overflow:hidden;margin:0;padding:0;'>
in the header and footer and the --header-spacing 30 -T 45mm
parameters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With