Decompress the print-n.x-n.n.tar.gz file into your Drupal modules directory (usually sites/all/modules, see Installing Modules for more information).
Enable the print module: Administer > Site building > Modules
Enable user permissions: Administer > User > Permissions
The print_pdf module requires the use of an external PDF generation tool.
The currently supported tools are wkhtmltopdf, dompdf and TCPDF. Please note that any errors/bugs in those tools need to be reported and fixed by their maintainers. DO NOT report bugs in those tools in the print module's issue queue at Drupal.org.
Error when installing
A noted bug when installing can cause this module to fail when enabled. The error message will look like
DatabaseSchemaObjectExistsException: Table print_pdf_node_conf already exists. in DatabaseSchema->createTable() (line 657 of /webiste/includes/database/schema.inc).
If this happens to you, simple run the update.php
Your.Website.com/update.php script and that has should fix the problem.
The dompdf tool produces results that are more faithful to the HTML printer-friendly page.
- Download dompdf from https://github.com/dompdf/dompdf
- Extract the contents of the downloaded package into your libraries directory (e.g.: "sites/all/libraries").
- Check if dompdf_config.inc.php fits your installation. In 99% of cases, no changes are necessary, so just try to use it and only edit anything if the PDF generation fails.
- Grant write access to the lib/fonts directory to your webserver user.
- If you're using dompdf-0.5.1, delete the dompdf.php file as it contains a security vulnerability
- The required php-font-lib is not included with the current download so if you need to download and install it manually. a href="http://stackoverflow.com/questions/13431905/php-font-lib-must-either-be-installed-via-composer-or-copied-to-lib-php-font-lib/13432787#13432787>More information
- Check http://code.google.com/p/dompdf/ for further information.
TCPDF seems to be more actively developed than dompdf, but it's support for CSS is considerably worse.
- Download TCPDF from http://sourceforge.net/projects/tcpdf/
- Extract the contents of the downloaded package into your libraries directory (e.g.: "sites/all/libraries"). There is no need to modify the config/tcpdf_config.php file, as the module self-configures TCPDF.
- Check http://tcpdf.sourceforge.net/ for further information.
wkhtmltopdf launches a browser to generate the PDF, so the output is completely faithful to the contents of the page. However, it requires a LOT more memory and processing power, and you may need to compile/install it in your system to use it.
- Download wkhtmltopdf from http://code.google.com/p/wkhtmltopdf/downloads/list. You can choose to download the source and compile it or simply download the static binary, which doesn't require you to complile anything.
- Place the wkhtmltopdf executable into the your libraries directory (e.g.: "sites/all/libraries"). You can also place a symbolic link to the executable. IMPORTANT: make sure you give executable permission such as 755 to wkhtmltopdf file
- You will need a running X Server or the virtual (headless) X framebuffer server: Xvfb. Place the Xvfb binary or a symbolic link to it in the print module directory (usually sites/all/modules/print/lib).
- Check if Drupal status reports any errors at: http://domain.tld/admin/reports/status
- If you see the error: "Unsupported wkhtmltopdf version", you probably need to install 3 depended libraries: e.g.
sudo aptitude install libxrender1 libfontconfig libXext-dev
- Check http://code.google.com/p/wkhtmltopdf/ for further information.
Switch on dompdf or one of the other options in Administer › Site configuration › Printer, e-mail and PDF versions › PDF › PDF generation tool.
When updating from a previous version, just remove the print directory and follow the instructions above. Make sure that you backup any customisation to the print.tpl.php and print.css files.
Even though it is possible to set per-page robots settings, the following can be placed in your robots.txt file after the User-agent line to prevent search engines from even asking for the page:
Also, for updates from older versions (<=4.7.x-1.0 and <=5.x-1.2) which used node/nnn/print instead of print/nnn, the following lines can prevent requests from Google for the obsolete print URLs:
Note that pattern matching in robots.txt is a Google extension (see http://www.google.com/support/webmasters/bin/answer.py?answer=40367 for more information).
Dompdf 0.5/0.6 compatibility issues are in http://drupal.org/node/552256.