Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript_delay throwing error in wicked_pdf

Environment:- Ruby - 1.9.3 , Rails - 4.0.0

I am generating pdf using wicked_pdf gem.

For this, I used below code in my controller:-

respond_to do |format|
    format.html
    format.pdf do
        render :pdf => 'contractors_data',
               :javascript_delay => 5000,
               :disposition => 'attachment',
               :template => 'tiles/templates/pdf/contractors.pdf.erb',
               :header => { :right => 'Page [page] of [topage]' }

end

In this pdf, I am generating a graph using $.plot method of javascript/jquery. So I want to wait pdf generator to wait till $.plot not respond and not plot graph over pdf.

I am sure and confirmed that javascript and jquery are working on this page as I used using wicked_pdf_javascript_link_tag for this.

Now I used :javascript_delay => 5000 in respond_to format option. But it is throwing error in generating while :redirect_delay => 5000 are working properly.

I tries this in cmd prompt also. I am getting error on cmd similar to GUI working.

Please answer with good solution. If possible, please provide code also for reference.

like image 387
RohitPorwal Avatar asked Oct 17 '13 11:10

RohitPorwal


1 Answers

As I said in my comment, your version of wkhtmltopdf is outdated. The javascript-delay option was introduced in version 0.10.0. Here's the manual for 0.9.9, you'll see no such option.

like image 71
Mark Avatar answered Oct 22 '22 16:10

Mark