views:

136

answers:

1

Hi, I wanted to create PDFs for my rails application using wkhtml2pdf and wicked_pdf.
I downloaded and extracted wkhtml2pdf beta 4 and placed it in /usr/local/bin/wkhtml2pdf
I tried running it on a web site and it gave a nice result.

In my rails application (2.3.4) I installed wicked_pdf:

script/plugin install git://github.com/mileszs/wicked_pdf.git
script/generate wicked_pdf

Everything seemed to be ok. inside script/console I run the following - (with the following output)

wp = WickedPdf.new

=># WickedPdf:0xb62f2c70 @exe_path="/usr/local/bin/wkhtmltopdf"

HTML_DOCUMENT = "<html><body>Hello World</body></html>"

=> "<html><body>Hello World</body></html>"

pdf = wp.pdf_from_string HTML_DOCUMENT

=> "/usr/local/bin/wkhtmltopdf - - -q"

=> "\n\n\n\n\n\n\n\n\n\n"

of course this isn't good. According to the test the result of my last command should start with "%pdf-1.4"

Any idea what I can do?

+1  A: 

Having the same problem. Removed the -q option from the wicked_pdf.rb file on line 19 and then was able to get the proper string on the console.

=> "%PDF-1.4\n1 0 obj\n<<\n/Title ...

This also seems to have solved other problems. The PDF still didn't render correctly when using it from the web site - embedded font issue - on to the next issue now.

Hopefully this will work for you.

Rob Sutherland