Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting a resolution for xvfb-run and wkhtmltopdf / wkhtmltoimage

I'm trying desperately to give xvfb-run some resolution arguments to take screenshots of websites with wkhtmltox in different resolutions.

I'm using both xvfb-run and wkhtmltox on CentOS.

xvfb-run --server-args="-screen 0 1024x768x24" wkhtmltoimage http://www.whatismyscreenresolution.com/ /tmp/bla.png

Unfortunately my arguments are not respected by xvfb-run. It has always a resolution of 800x600. What am I doing wrong here?

Thanks for any help!

like image 799
Tomukas Avatar asked Apr 07 '14 13:04

Tomukas


2 Answers

You forgot this option: --use-xserver.

So the whole command is:

xvfb-run --server-args="-screen 0 1024x768x24" wkhtmltoimage --use-xserver http://www.whatismyscreenresolution.com/ /tmp/bla.png

(I tested with wkhtmltopdf, but it should be the same with wkhtmltoimage)

like image 84
johndodo Avatar answered Nov 14 '22 07:11

johndodo


Add a comma between parameters. In your case "-screen 0, 1024x768x24". Let me know if it helped you. Regards, HBK

like image 41
Hbksagar Avatar answered Nov 14 '22 06:11

Hbksagar