wicked_pdf doesn’t work on Windows

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.

About these ads

4 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s