On a rails 3.2.18 application, with wicked_pdf (0.11.0) and wkhtmltopdf-binary (0.9.9.3) declared in the gem file, mime-types.rb was not amended to includeMime::Type.register "application/pdf", :pdf
otherwise, on startup of Thin on osX development platform, the following warning is given:
/Users/it/.rvm/gems/ruby-1.9.3-p125@app/gems/actionpack-3.2.18/lib/action_dispatch/http/mime_type.rb:102: warning: already initialized constant PDF
An initializer states
WickedPdf.config = {
:exe_path => '/usr/local/bin/wkhtmltopdf'
}
The path /usr/local/bin
does include an alias to wkhtmltopdf. In a show view:
def show
@transaction = Transaction.find(params[:id])
respond_to do |format|
format.html { render :layout => 'pdf' } # show.html.erb
format.pdf do
render :pdf => "invoice_name"
end
format.json { render json: @transaction }
end
end
The show view renders appropriately. Append the path with .pdf
and the console registers:
"***************[\"/usr/local/bin/wkhtmltopdf\", \"-q\", \"file:///var/folders/kV/kVDOSPkcEuqSVnTjenAVRE+++TI/-Tmp-/wicked_pdf20141018-1401-m614pd.html\", \"/var/folders/kV/kVDOSPkcEuqSVnTjenAVRE+++TI/-Tmp-/wicked_pdf_generated_file20141018-1401-1hor23g.pdf\"]***************"
And the server hangs. It gets interrupted with ctrl-c
and then the server console adds:
[...]
Rendered transactions/show.pdf.erb (12.1ms)
Rendered text template (0.0ms)
Sent data invoice_name.pdf (18.8ms)
Completed 200 OK in 36322.7ms (Views: 15.2ms | ActiveRecord: 3.0ms)
Exiting
which it did not do. Other attempts to simply generate a file and save it have led to non-production of the PDF file, but without hanging the Thin server. So the engines are not all running properly...
What is wrong with the set-up?