Here's instructions how to install dompdf manually, since the official instructions only support installation through Composer.

Components I used:

  • Drupal 8.7.5 on Debian stretch 9.9 with apache 2.4.25
  • PHP 7.2.18-1, MariaDB5.5.5-10.1.38
  • EntityPrint module 8.x-2.1+3-dev
  • dompdf 0.8.3

Target folder: the 'vendor' folder in the site root folder. This means the 'vendor' folder in the same directory as the 'core' and 'modules' folders.

  • Download the latest dompdf zip from https://github.com/dompdf/dompdf/releases. Do not use the Source code downloads.
  • Unpack the zip in the vendor folder, so that the files end up in <siteroot>/vendor/dompdf/dompdf/
  • Double check: the following file should now exist in this location: <siteroot>/vendor/dompdf/dompdf/src/Dompdf.php

Then, add the following to <siteroot>/vendor/autoload.php

require_once __DIR__ . '/dompdf/dompdf/lib/html5lib/Parser.php';
require_once __DIR__ . '/dompdf/dompdf/lib/php-font-lib/src/FontLib/Autoloader.php';
require_once __DIR__ . '/dompdf/dompdf/lib/php-svg-lib/src/autoload.php';
require_once __DIR__ . '/dompdf/dompdf/src/Autoloader.php';
Dompdf\Autoloader::register();

Add this BEFORE the 'return' line (last line of the file). Save and exit.

Check ownership and permissions of the new files.

Clear cache.

Done.

Check under /admin/config/content/entityprint:

  • the notice about dompdf missing should be gone
  • dompdf should be selectable in the PDF dropdown

extra checks:
go to url <site address>/entityprint/pdf/node/<some node id>
This should get you a pdf of that node

go to url <site address>/entityprint/pdf/node/<some node id>/debug
This should give you a html page of that pdf.

Final tip:
In the source of the html page you can retrieve the html elements and css classes to style the pdf with css.
Add your custom css to <site root>/modules/entity_print/css/entity-print.css

GLHF
Mark.

Comments

cpdp created an issue. See original summary.

cpdp’s picture

Issue summary: View changes
april26’s picture

Thank you so much - this is so clear!

Anonymous’s picture

Thank you - as my hoster does not allow command line access and therefore also no composer.

Anonymous’s picture

Oh my word. I struggled a lot until I realised that the code above to be pasted into autoload.php should go before the last line of code which is
"return ComposerAutoloaderInitce58b5d98b41b71861b22b5cdcf13ed1::getLoader();"

For some reason I thought you meant it should be pasted on the last line of the document. Now it works.

Thanks for the manual instructions!

hazit’s picture

Thank you thank you thank you!

This is the clearest instruction I have seen yet on installing libraries without composer. Thankyou! :-)

lhubbert’s picture

Sending a virtual box of cookies your way - thank you for the very clear directions!

ab2211’s picture

Hm, I get an 500er error, after putting the code to autoload.php. No, my fault, it works perfectly!

kirankumar.sana’s picture

Awesome, it is working perfectly in v8.6 using entity_print 8.x-2.1. Thank you very much

VortexCentrum’s picture

Kudos.

Installed latest dompdf (1-0-2) in D9-2.5.

Works immediately.

This is my autoload.php - I put the lines from this page before Composer's "Require Once" because it seemed logical not to split the two lines of its instructions.

-----------------------------------------------------

<?php

//autoload dompdf no composer

require_once __DIR__ . '/dompdf/dompdf/lib/html5lib/Parser.php';
require_once __DIR__ . '/dompdf/dompdf/lib/php-font-lib/src/FontLib/Autoloader.php';
require_once __DIR__ . '/dompdf/dompdf/lib/php-svg-lib/src/autoload.php';
require_once __DIR__ . '/dompdf/dompdf/src/Autoloader.php';
Dompdf\Autoloader::register();

// autoload.php @generated by Composer

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit4eedd22b05121b4ddc49b49c1fb16ba5::getLoader();

--------------------------------------

Brilliantly clear instructions. I wish the whole of D8/9 was written in such a step by step fashion.

larowlan’s picture

Status: Active » Fixed

Thanks, as there's nothing to action here, other than leaving this as a point of reference for people searching with a search engine, marking as closed

Status: Fixed » Closed (fixed)

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