

#Ruby pdfkit windows pdf
You also need to install the pdfkit gem, and then run the following bit of Ruby to generate a PDF with the text Hello Envato You should have a new file called hello.pdf with the text at the top. You can download the binary or install from Brew on Mac, or your preferred Linux repository. Set the permissions on the file sudo chmod 755 /usr/local/bin/wkhtmltopdf-0.10.0.rc2Īfter doing all of this, and restarting my server, PDFKit will now use the wkhtmltopdf that I have installed on the server.Ĭaveat: On one occasion my Rails application started reporting that it couldn't find the wkhtmltopdf executable in the path, not sure why as nothing changed. To start, install wkhtmltopdf on your computer.

Now setup a symbolic link to the file so it's easy to upgrade at a later point sudo ln -s /usr/local/bin/wkhtmltopdf-0.10.0.rc2 /usr/local/bin/wkhtmltopdf Move it to the /usr/local/bin/ directory sudo mv wkhtmltopdf-0.10.0.rc2 /usr/local/bin/ This issue is referenced at Įxtract the executable from the tar archive tar -xvf wkhtmltopdf-0.10.0_2 There is a bug in the latest suggested download versions that prevent a user from being able to select and copy text from a generated PDF, but this version doesn't have that bug. Uninstall the gems from the server that you're running the Rails application on gem uninstall wkhtmltopdf -aĭownload to your server wkhtmltopdf-0.10.0_2 from the project download site here. Remove any config/initializers/pdfkit.rb file In your config/initializers/mime_types.rb file add Mime::Type.register "application/pdf", :pdf Remove any reference to wkhtmltopdf or wkhtmltopdf-binary from your Gemfile.Īdd only gem 'pdfkit', :require => 'pdfkit' to your Gemfile This is what I needed to do to make PDFKit work with wkhtmltopdf for my Rails application running on 64-bit Ubuntu 12.04 LTS. Fl00r, and I, are both assuming that it's a Linux system, so adjust accordingly.

I don't see you mention which operating system you're on.
