I'm trying to make Entity Print work but I'm having issues with configuring the module.

The project I'm working on is two years old and for some reasons, I can't use composer and the module folder is at the project's root. The modules that have been created manually are in modules/custom, those downloaded are in modules/contrib

I downloaded and unzipped dompdf 0.8.1 in my vendor directory, and did the same in modules/contrib for Entity Print.

However, after the installation, when I try to make the module work, I get the message

"Dompdf is not available because it is not configured. Please install with: composer require "dompdf/dompdf 0.8.0".

I have the choice between TCPDF (v1) that gets a PHP error when activated, that makes me need to reinstall the module if I want to get back to the configuration page, and Php Wkhtmltopdf that can't reach the server X even though I installed every related libraries I could find.

One coworker told me that he managed to make Entity Print work with DomPDF, but he couldn't remember how, even though it had something to do with the autoload.

I can't manage to make the couple solutions I found, and I don't really know what I'm looking for.

Please tell me if you need to see a file's content, I don't really know what I can show you for now.

Thank you in advance

  • 1
    Probably because you are missing the actual dompdf library (retrieved with Composer) and then the autoloader needs to be updated with the information so it is detected. Composer is required for external packages. – Kevin Oct 5 '17 at 13:38
  • If I go at packagist.org, I get the same dompdf than the same github, I don't think there are differencies... But what should I do about the autoloader? Which one should I edit? – Jaeger Oct 5 '17 at 13:41
  • You shouldn't edit those files manually. The 2.x version of Entity Print lists dompdf as a require, which would have auto downloaded with Composer and updated everything appropriately: cgit.drupalcode.org/entity_print/tree/composer.json?h=8.x-2.x – Kevin Oct 5 '17 at 13:42
  • 1
    I'm fully aware that I wouldn't even have to ask this question if I could use Composer, but I simply can't (for dumb reasons, but still, it was like this even before I got on this project. For now, I get errors when trying to use composer in this project) – Jaeger Oct 5 '17 at 13:46
  • I'm not sure how to answer that, there is no way around using Composer in this instance, as the module has listed an external dependency as a requirement to install. A cursory Google search doesn't show any real way around using it. – Kevin Oct 5 '17 at 13:53

I have been using the same module and was able to get it setup with Dompdf. Here are the steps in detail I used.

Summarized steps:

  1. composer require drupal/entity_print (this automatically downloads the dompdf dependency for me)
  2. On the content type, I enabled the custom display setting of PDF
  3. Followed steps in "From your theme" to create the print.css and twig templates
  4. composer require dompdf/dompdf (in case #1 doesn't download it)

Alternative: Ludwig module

| improve this answer | |
  • 1
    If you read the question again, I specified I couldn't use Composer, still that's how I'd do it too :) – Jaeger Jan 23 '18 at 19:47
  • @Jaeger the output of the composer file has a directory structure of /vendor/dompdf/dompdf and all the files are underneath this. Could you not try to download via composer on a separate local instance and then copy those folders into your vendor directory? I see a difference between composer downloaded dompdf and the one from github. – usernameabc Jan 23 '18 at 20:28
  • That's what I did at the end, but it was really off, and Drush couldn't set Dompdf up so it was more a loose of time than anything – Jaeger Jan 23 '18 at 21:49
  • @Jaeger not sure if any of these will help but i updated my comment. This is the closest that i have found. – usernameabc Jan 23 '18 at 21:54

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.