简体   繁体   中英

I can't get rails plugin wicked_pdf to work

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM