2
$command = "/usr/local/bin/wkhtmltoimage --quality 70 --crop-w 800 --crop-x 50 --javascript-delay 900 --height 800";

Hello, i've finished simple script to convert any url to jpg via wkhtmltoimage im using this for facebook, but sometimes it works sometimes not with default setting --javascript-delay 200 screenshot was empty, with 900ms delay it's working ok. but sometimes one or more image is missing, i've tried to disable javascript, or change wait time to even 2s but sometimes work, sometimes not. I need simple solution to make screenshot from facebook url, but i dont want use third parties services. There is any setting to avoid this issue ? and retry when image was not saved ? Because sometimes also image is not saved, and this is too often to accept this.

  • i would use an event instead of a timer, if possible. the other option is to try to examine the image to see if it's incomplete and should be "retaken". – dandavis Feb 07 '15 at 23:01
  • i need fast response, as fast as possible, in this way it takes too long. –  Feb 08 '15 at 00:00
  • the fastest way is by using events since they let you know exactly when something is done. now, if your tools provide such events, i don't know. – dandavis Feb 08 '15 at 00:02

1 Answers1

0

Option --disable-smart-width worked for me. I had a similar issue capturing screenshots from some sites that did not render completely.

Check what the guy in this GitHub issue did https://github.com/wkhtmltopdf/wkhtmltopdf/issues/2408.

Unlike him, I did not have to disable javascript and I also did not have to add a delay.

Gus Ortiz
  • 652
  • 3
  • 9