I am unable to find any detailed documentation for enabling the PDF option. I have tried TCPDf and dompdf, none worked for me.
I have copied the downloaded files to the sites/all/libraries/dompdf folder, but when I login to the site I get the following error:
Warning: require_once(/home/site/public_html/sites/all/libraries/dompdf-0.6.1/lib/php-font-lib/classes/Font.php) [function.require-once]: failed to open stream: No such file or directory in require_once() (line 332 of /home/site/public_html/sites/all/libraries/dompdf-0.6.1/dompdf_config.inc.php).

and when I click on the PDF icon or when I go to Configuration of Drupal [/admin/config], I get the following error:
Fatal error: require_once() [function.require]: Failed opening required '/home/site/public_html/sites/all/libraries/dompdf-0.6.1/lib/php-font-lib/classes/Font.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/site/public_html/sites/all/libraries/dompdf-0.6.1/dompdf_config.inc.php on line 332

What am I missing?
Can someone tell me how to configure the PDF option please or how to make one of the PDF external downloads work? thanks!

Comments

vako’s picture

Issue summary: View changes
vako’s picture

SOLUTION:
In dompdf_config.inc.php, change line 332 to point to the actual location of your Font.php file.
mine was /php-font-lib/src/FontLib

There is no CLASSES folder that was mentioned there.

drupalstewy’s picture

Hi,
I downloaded DOMPDF from github. https://github.com/dompdf/dompdf, v 0.6.1.

If I copy the extracted folder in libaries, the Font.php file is not in /dompdf/lib/... but in /dompdf/www
So how can I point to it in dompdf_config.inc.php, line 332?

if (DOMPDF_ENABLE_AUTOLOAD) {
  require_once(DOMPDF_INC_DIR . "/autoload.inc.php");
  require_once(DOMPDF_LIB_DIR . "/php-font-lib/classes/Font.php");
}

(Sorry, I'm a noob in php)

reign85’s picture

rcodina’s picture

Thanks for the info. Another option is to manually download https://github.com/PhenX/php-font-lib and put it to dompdf/lib/php-font-lib

vako’s picture

I hope these latest changes will be documented in the installation readme file of the module.

jcnventura’s picture

Title: Documentation for the PDF option » dompdf install is too complicated. Document step-by-step instructions
chris dart’s picture

I finally got mine to work.

  • I downloaded the dompdf from the google-hosted code site at dompdf
  • Then I downloaded (git cloned https actually) php-font-lib from the project's github site.
  • I put the downloaded files into the sites/all/libraries folder.
  • After extracting dompdf, rename to dompdf-0.6.1. This is a critical step. Unlike other libraries where you typically remove the version information from the directory, you must add the version number to it for this to work.

Of course, I had a problem with the output being unreadable because it was covered with boxes with "X"es in them, but I posted that under a different issue queue.

ferriol’s picture

I've made it work the dompdf 0.6.1 version. With #2 or copying /php-font-lib/src/FontLib in a new /php-font-lib/classes

But when I add a font-face in my stylesheet I have blank pages cause a
PHP message: PHP Fatal error: Class 'Font' not found in /var/www/.../modules/print/lib/dompdf-0.6.1/include/font_metrics.cls.php on line 346"

I solved installing php-font-lib 0.2.2 it seems that dompdf-0.6.1 is not compatible with releases of php-font-lib greater of 0.2.2, may be the next release. At this moment doesn't exist yet

Yes, dompdf is complicated to install. But its free software, and that's great ! It make as free as in freedom.

rcodina’s picture

wafer’s picture

I am working on a view that render pdf,every thing is fine,I have tried to show a watermark but it's only showing on first page.I am using dompdf 0.6 with Drupal 7 print module,is it possible to add header and footer template with that watermark on every pages.

I have attached a pdf,which I need to customize.
Your solicited advice is needed.Please.

davidreedernst’s picture

From what I can tell, this problem has gotten worse. The documentation says:

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.

I wish that it would say where I should expect to find dompdf_config.inc.php, but wherever that was, I'm pretty sure it's not there anymore. I've downloaded the latest (as of 2016-02-16) versions of the following from github: dompdf, php-font-lib, & php-svg-lib. I'm using v 7.x-2.0 of the print module. I've used find on the command line to search for this file, and I don't see it anywhere. My best guess is that it used to be part of the dompdf package, but it was removed along the way, and the drupal print module documentation hasn't been updated to reflect this fact.

Of course, if it were there, I still wouldn't know what it means "to use it". Was it supposed to autoload? Do i need to copy/link to it from some other place? The documentation should be more clear about this too.

As it stands now, I've tried moving the dompdf folder all over, including a version number per Chris Dart's comment, and the print module still says "No PDF generation tool found!". Any guidance would be appreciated.

mrchristophy’s picture

Same problem here - the instructions don't have any relation to the contents of dompdf.

EDIT: Download this version of dompdf and it seems to work: https://github.com/dompdf/dompdf/releases/tag/v0.6.1

vertikal.dk’s picture

#10 is right as of writing this.

Look to the right and "download zip" at
https://github.com/dompdf/dompdf/archive/v0.6.1.zip
https://github.com/PhenX/php-font-lib/tree/0.2.2

First unpack dompdf at /sites/all/libraries/dompdf-0.6.1/
Then place everything in phpfontlib in /home/site/public_html/sites/all/libraries/dompdf-0.6.1/lib/php-font-lib/

/home/site/public_html/sites/all/libraries/dompdf-0.6.1/lib/php-font-lib/classes/Font.php should then be accessible and it should work.

If you're still having trouble check the permission in the folder.

http://www.linux.org/threads/file-permissions-chmod.4094/

retiredpro’s picture

#15's post by vertikal.dk's worked for me. Thank you everyone for figuring this out.

hockey2112’s picture

Thank you, #15!

BartNijs’s picture

#15 did it for me as well. These easy steps should be added to the documentation.

FranCarstens’s picture

#15 worked for me as well. Just remember to actually enable the print_pdf_dompdf module.

adamps’s picture

Note that dompdf 0.6.1 as mentioned in #15 has security vulnerabilities so you should use 0.6.2 instead. Don't use 0.7.0 as it is not yet compatible with this module.

heddn’s picture

Note, do to security advisories before 6.2, and the recent launch of the 7 branch, you might want to head over to #2818589: Support dompdf version 0.7 move that issue along.

jcnventura’s picture

Status: Active » Fixed

I've updated the INSTALL.txt for dompdf slightly, but it's clear that this is caused by downloading the source release of the dompdf library.. Please make sure to download full builds from https://github.com/dompdf/dompdf/releases

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

madjr’s picture

Also don't forget that after downloading dompdf libraries, go back to the modules admin page and enable the print module companion: "dompdf library handler" module.