Lately I had to implement the functionality of exporting an HTML page in PDF format in one of my Projects. Since I was using Ruby on Rails so I decided upon using the plugin wicked_pdf.
You get all the guidelines on the github site for implementing wicked_pdf. So I am not going into it. But if you are a windowss user. You get the error
NotImplementedError: fork() function is unimplemented on this machine
This error is generated because wicked_pdf still struggles to provide support for Windows OS. So after a lot of gooooogling I came up to this……
Step 1 :- Install the gem win32-open3, this can be done using the following script
gem install win32-open3
The win32-open3 library provides a working implementation of the open3 library for MS Windows. In addition, it provides the Open4 class, which also returns pid information. Note that this library is unnecessary with Ruby 1.9.x because of its support for native threads.
Step 2 :- Now go to the plugins/wicked_pdf/lib directory and open the file wicked_pdf.rb
On line 6 of this file you have
require 'open3'
Change this line to
require 'win32/open3'
Step 3 :- And now try using the guidelines provided on github for the implementation of wicked_pdf.
Its works.
Is this fix working on linux?
@Lukom I don’t think this will work as a fix for Linux machines. As you can clearly see that I am using the win32-open3 gem which itself is a windows native.
Coooooooooolllllllllll
I was just searching for this, and stumbled upon your blog. Good work.