{"action":"created","issue":{"url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/397","labels_url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/397/labels{/name}","comments_url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/397/comments","events_url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/397/events","html_url":"https://github.com/mileszs/wicked_pdf/issues/397","id":65125786,"number":397,"title":"javascript_delay is not working","user":{"login":"vsrboth","id":5484995,"avatar_url":"https://avatars.githubusercontent.com/u/5484995?v=3","gravatar_id":"","url":"https://api.github.com/users/vsrboth","html_url":"https://github.com/vsrboth","followers_url":"https://api.github.com/users/vsrboth/followers","following_url":"https://api.github.com/users/vsrboth/following{/other_user}","gists_url":"https://api.github.com/users/vsrboth/gists{/gist_id}","starred_url":"https://api.github.com/users/vsrboth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsrboth/subscriptions","organizations_url":"https://api.github.com/users/vsrboth/orgs","repos_url":"https://api.github.com/users/vsrboth/repos","events_url":"https://api.github.com/users/vsrboth/events{/privacy}","received_events_url":"https://api.github.com/users/vsrboth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-30T03:16:41Z","updated_at":"2015-03-30T04:00:39Z","closed_at":null,"body":"I am currently facing a problem with `javascript_delay` option.\r\nThis seems not working as explain in the READ.MD, here is the error I got:\r\n\r\n`RuntimeError - Error: Failed to execute:\r\n[\"/Users/sereyboth/.rvm/gems/ruby-2.0.0-p353@yoolk_portal/bin/wkhtmltopdf\", \"-q\", \"--javascript-delay\", \"6000\", \"file:///var/folders/ms/3gmwdkpd1cs4j8gmzlj8g6zc0000gn/T/wicked_pdf20150330-2170-1b0861o.html\", \"/var/folders/ms/3gmwdkpd1cs4j8gmzlj8g6zc0000gn/T/wicked_pdf_generated_file20150330-2170-1fwwqff.pdf\"]\r\nError: PDF could not be generated!\r\n Command Error: Bundler is using a binstub that was created for a different gem.\r\nThis is deprecated, in future versions you may need to` `bundle binstub wkhtmltopdf` `to work around a system/bundle conflict.\r\nUnknown long argument --javascript-delay`\r\n\r\nName:\r\n  wkhtmltopdf 0.9.9`\r\n\r\n\r\nMy current `wicked_pdf` and `wkhtmltopdf-binary`\r\n\r\ngem 'wicked_pdf',                   '~> 0.11.0'\r\ngem 'wkhtmltopdf-binary',           '~> 0.9.9.3'"},"comment":{"url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/comments/87535184","html_url":"https://github.com/mileszs/wicked_pdf/issues/397#issuecomment-87535184","issue_url":"https://api.github.com/repos/mileszs/wicked_pdf/issues/397","id":87535184,"user":{"login":"unixmonkey","id":8360,"avatar_url":"https://avatars.githubusercontent.com/u/8360?v=3","gravatar_id":"","url":"https://api.github.com/users/unixmonkey","html_url":"https://github.com/unixmonkey","followers_url":"https://api.github.com/users/unixmonkey/followers","following_url":"https://api.github.com/users/unixmonkey/following{/other_user}","gists_url":"https://api.github.com/users/unixmonkey/gists{/gist_id}","starred_url":"https://api.github.com/users/unixmonkey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unixmonkey/subscriptions","organizations_url":"https://api.github.com/users/unixmonkey/orgs","repos_url":"https://api.github.com/users/unixmonkey/repos","events_url":"https://api.github.com/users/unixmonkey/events{/privacy}","received_events_url":"https://api.github.com/users/unixmonkey/received_events","type":"User","site_admin":false},"created_at":"2015-03-30T04:00:39Z","updated_at":"2015-03-30T04:00:39Z","body":"Looks to me like you want to wait until the chart is fully drawn (with JS) before you want wkhtmltopdf to take its screenshot, instead of waiting before the JS fully executes. Instead of wrapping your JS, try adding the setTimeout outside:\r\n\r\n```js\r\nfunction drawPieChart() {\r\n  // code to draw chart\r\n  setTimeout(function(){ /* do nothing */ }, 6000);\r\n}\r\n```\r\nThis might coax the browser to wait before taking its snapshot, but I would suggest you do update `wkhtmltopdf`. This StackOverflow thread shows someone had success with Flot:\r\n\r\nhttp://stackoverflow.com/questions/19425421/javascript-delay-throwing-error-in-wicked-pdf\r\n\r\n"}}