I can't get rails plugin wicked_pdf to work

I wanted to create PDF files for my rails application using wkhtml2pdf and wicked_pdf.
I downloaded and extracted wkhtml2pdf beta 4 and placed it in / usr / local / bin / wkhtml 2pdf
I tried to run it on a website and it gave a good result.

In my rails application (2.3.4), I set wicked_pdf:

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

Everything seemed to be in order. 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 is not good. According to the test, the result of my last command should start with "% pdf-1.4"

Any idea what I can do?

+4
source share
1 answer

With the same problem. I removed the -q option from wicked_pdf.rb on line 19, and then I was able to get the desired line on the console.

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

It also seems to have solved other problems. The PDF file still does not display correctly when using it from a website - the problem with the embedded font - now to the next problem.

Hope this works for you.

+1
source

Source: https://habr.com/ru/post/1314405/


All Articles