I want to generate PDF from a html doc in a rails app. So I decided to use wicked_pdf. But its not working. I tried to integrate it in an app, but it did not work. So I thought of trying to see if it works in the rails console then i will integrate it in the app.
Here’s what I came across in the console
wp = WickedPdf.new
=> #<WickedPdf:0x4e7eea0 @exe_path="C:\\wkhtmltopdf\\wkhtmltopdf.exe">
HTML_DOCUMENT = "<html><body>Hello World</body></html>"
=> "<html><body>Hello World</body></html>"
pdf = wp.pdf_from_string HTML_DOCUMENT
"***************C:\\wkhtmltopdf\\wkhtmltopdf.exe - - ***************"
NotImplementedError: fork() function is unimplemented on this machine
from C:/Ruby/lib/ruby/1.8/open3.rb:57:in `fork'
from C:/Ruby/lib/ruby/1.8/open3.rb:57:in `popen3'
from C:/Users/raw/Desktop/html/scheduler/vendor/plugins/wicked_pdf/lib/wicked_pdf.rb:22:in `pdf_from_string'
from (irb):3
UPDATE: I am using Windows7
I am not able to figure out where I am going wrong.
Please help.
Thanks in advance.
Install the gem win32-open3
And now Change line:6 in lib/wicked_pdf.rb
require ‘open3’
to
and line:20 in the same file
to
and now in console I get
Take a look at this blog post for understanding it.
Thanks.