We've been running into a problem recently, some pages don't seem to work when the
--height
option is omitted (or manually set to 0)
D:\Tools>wkhtmltoimage.exe -V
wkhtmltoimage 0.12.2.1 (with patched qt)
Without the --height
option:
D:\Tools>wkhtmltoimage.exe http://www.reanmachine.com/this-is-a-test/ d:\out.png
Loading page (1/2)
Rendering (2/2)
Error: Will not output an empty image
QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::translate: Painter not active
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setBrush: Painter not active
QPainter::pen: Painter not active
QPainter::setPen: Painter not active
QPainter::end: Painter not active, aborted
Error: Could not save image
Exit with code 1, due to unknown error.
With the --height
option:
D:\Tools>wkhtmltoimage.exe --height 1000 http://www.reanmachine.com/this-is-a-test/ d:\out.png
Loading page (1/2)
Rendering (2/2)
This is problematic since we don't know the target height, it should be inferring it from the rendered content.
This occurs on Windows 8.1, Windows 2008 R2, and Windows 2012
Here's some further information to help narrow down the problem:
It seems this combination of CSS was causing the tool to get a 0-height (null image?)
html { overflow-x: hidden; }
body { overflow-x: hidden; }
You can demo it by trying to render this page:
http://jsbin.com/cagus/1
It seems this is a behavior being used in mobile-first design to prevent horizontal scrolling in all cases:
https://stackoverflow.com/questions/8635799/overflow-xhidden-still-can-scroll
It's prevelant in many modern site designs.
Here's some further information to help narrow down the problem:
It seems this combination of CSS was causing the tool to get a 0-height (null image?)
html { overflow-x: hidden; }
body { overflow-x: hidden; }
You can demo it by trying to render this page:
http://jsbin.com/cagus/1
It seems this is a behavior being used in mobile-first design to prevent horizontal scrolling in all cases:
https://stackoverflow.com/questions/8635799/overflow-xhidden-still-can-scroll
It's prevelant in many modern site designs.
this works
thanks bro