3

I have installed the drupal Print module, but have not been successful in getting wkhtmltopdf to work. The drupal print documentation is outdated and despite of a number of request to update it, it still is outdated. https://www.drupal.org/node/306882

CASE DESCRIPTION In my case, I want to allow the creation of pdf versions of nodes. The Nodes have inline CSS (using Tinymce editor with Wysiwyg). I tried using Dompdf library, but the inline css is not being used for the created pdf.

I have read that wkhtmltopdf creates an internal browser that renders a html page, so that should be the ideal solution in this case.

However, after downloading the rpm file from http://wkhtmltopdf.org/ into the sites/all/libraries folder of my website, and installing it using rpm -Uvh wkhtmltox-0.12.2.1_linux-centos6-amd64.rpm in my website, the library is not recognized, not visible in the status report page and not in the pdf configuration page /admin/config/user-interface/print/pdf

  • Have restarted your web server and made sure the installed executables have the correct permissions so that that the web server process has access to it? – Shawn Conn Apr 11 '15 at 16:31
  • Are you sure the library is installed in sites/all/libraries? As far as I recall, RPM install files in system directories. – kiamlaluno Apr 12 '15 at 4:28
  • I have restarted the website, the rpm has the correct permissions, the command line test to create a pdf of www.google.com was successful. But wkhtmltopdf is not visible as option in not in the pdf configuration page /admin/config/user-interface/print/pdf – Yuri Apr 29 '15 at 3:13
  • Is this for D7 and D8? – usernameabc Jan 10 '18 at 17:38
  • This is for D7. – Yuri Jan 10 '18 at 20:58
1

In addition to Yuri's answer, I wanted to provide more detail for how I solved this issue, where I couldn't resolve the following error:

No PDF generation tool found! Please download a supported PHP PDF generation tool

  1. install the print module
  2. install pdf php handlers and libraries for your environment from https://wkhtmltopdf.org/downloads.html; see note
  3. create symlink in sites/all/libraries/wkhtmltopdf to library in server; make sure symlink is executable to the server sudo chown -h [owner]and sudo chgrp -h [group]
  4. install and enable phpwkhtmltopdf
  5. run drush make --no-core -y sites/all/modules/contrib/phpwkhtmltopdf/phpwkhtmltopdf.make
  6. enable print_pdf_wkhtmltopdf
  7. set up and customize; see recommendations in this blog for more info

Note: My local dev environment is on a Mac OS X so I had to download and run the package, then create a symlink to sites/all/libraries/wkhtmltopdffrom /usr/local/bin/wkhtmltopdf

Sources:

  • Why do you need the print module? – eSentrik Mar 1 '18 at 19:02
  • Good question. I can only guess that I needed to use the print module for printer friendly pages and then needed the other stuff for it to work. – Christia Mar 6 '18 at 3:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.