Module Entity Print

Hi

I have installed the Entity Print module and I get this error message:
error-drupal
It seems that I need to install a PDF engine, do I really need this?

Thanks for the info
Regards
Almudena

Hello Almudena,

To be honest I haven’t used the Entity Print module before, but also it’s a contributed module so it is supported from the Drupal community, not from CERN.

Having said that you can always post your in the issues page of the module

18

Kostas

Thanks a lot
regards
Almudena

Hi Almudena,

You need to install the external library dompdf. In order to do that enable the module Ludwig available in the infra.

Ludwig will make Entity Print to detect the external library. More information on how to use Ludwig and install external libraries you can find in our How To article here.

Also, you need to follow the instructions from this post https://www.drupal.org/project/entity_print/issues/3040695 in order to prepare the ludwig.json file and to add a line to Entity Print’s code to load the library.

If you need any more help with that let me know. I have installed it for one of my projects and works fine.

Thanks a lot.
I will try and I will see if I need more help…
Thanks again
Regards
Almudena

I would need your help.I tried to create this file :
macjoel:entityprint joel$ more /Volumes/_webdav/modules/entityprint/ludwig.json

{
    "require": {
        "dompdf/dompdf": {
            "version": "v0.8.0",
            "url": "https://github.com/dompdf/dompdf/archive/v0.8.0.zip"
        },
}

But I don’t understand what to do next ?
Any advice, please ?
Thanks

So there was a missing “}” but nothing change…

Hi Joel,

Unfortunately, Ludwig doesn’t always saves the day. For Entity Print you need another workaround.

Download the Entity Print module in your modules folder. Then create a lib folder within its folder and place there the dompdf library.

Then you need to edit the entity_print.module and add the following line at the top:

require_once(‘lib/dompdf-dompdf/v0.8.3/autoload.inc.php’);

This line tells the module from where to get the library from. The line above shows the structure of the lib folder and how you have to place the dompdf library.

Let me know if you need more help.

Hi
So I tried to follow your recipe but I don’t see any improvement:
macjoel:modules joel$ ls -al /Volumes/_webdav/modules/entity_print/lib
total 12
drwx------ 1 joel staff 2048 10 déc 08:15 .
drwx------ 1 joel staff 2048 10 déc 08:19 …
drwx------ 1 joel staff 2048 10 déc 08:15 dompdf-0.8.3
macjoel:modules joel$ grep dompdf /Volumes/_webdav/modules/entity_print/entity_print.module
require_once(‘lib/dompdf-0.8.3/autoload.inc.php’);

. When I go to my drupal site -> Confoiguration -> entity print, I still get the message.
SO What AM I doing wrong ?

Regards.
joel.

Hi Joel,

Could you give me the URL of your website? I need to take a closer look.

https://ep-th-safety.web.cern.ch/

It should be ok now.

There were two issues. First is that you were using an old version of dompdf 0.8.0 which has some problems. I installed the latest one 0.8.3 and works fine.

Second, when you copy pasted the require once line the single quotes had weird characters and this line couldn’t be read. I just replaced the quotes and worked fine.

Great … Thanks a lot

Hi, As I clone again the site, unfortunately, it overwrite all the actions did on modules.
SO I tried to dowlad and install dompdf 0.8.3 abnd you write the line require_once properly but I did not manage to make it work.
What did you do exactly to make it work, please ? (one diff was that my path is lib/dompdf-0.8.3 while your was dompdf-dompdf/v0.8.3… SO probablky not the same tar (https://github.com/dompdf/dompdf/archive/v0.8.3.tar.gz)

Hi Joel,

I have reinstalled and setup all the modules and I took a backup called “all modules installed” in case you accidentally delete it so you can restore it from.

Hi,

Sorry to unearth an old topic, but I face the very same issue. Since I am not in IT, but in HR, I face a few troubles to apply your solutions. First, the Entity Print module seems to be in core and I can’t access this module’s folder.

I tried to add a folder myself after downloading the Entity Print module, creating a lib folder etc, as you described with dompdf (also tried with Php Wkhtmltopdf), but got no success. I guess there is a conflict between my manually created folder and the core folder, hidden somewhere else. So I deleted my own folder as it was creating errors on the admin panel.

How do I proceed to find the installed and working folder for Entity Print ?

Regards,
Philippe
HR-LD

Dear Philippe,

What exactly is your use case? Can you provide some information on what you are trying to achive?

Hi Sotirios,

Thank you for your reply. I am using the Webforms module to create surveys with Drupal 8. I am using a test website, because I am exploring this as an option to replace our sharepoint solution that works but has some inconvenients. It is my initiative to help my team.

Right now it works and the results panel is displaying what I need. For communication purpose, extracting the results is an interesting option. Since there is an option for PDF, I wanted to explore this and see the results, but I can’t configure Entity Print to use a PDF engine, Dompdf or Wkhtmltopdf, I can only rely on excel format or managing access to results with an e-group for specific users.

As I am facing this issue and I see there is a topic about it, I wished to understand and try to solve this. But I do not see the folder and creating one was not helping me. I tried to import dompdf with the module importer of Drupal, but it tells me that I should use composer and refuses to activate the module…

Hi Philippe,

I advise against of doing what I will propose next especially if you are not experienced user and because it will make harder the maintenance of the website.

Now the Entity Print module requires the PDF Generator module in order to work. Mount the filesystem of your website and go into the PDF Generator module’s folder. Create a lib directory and copy dompdf files there. Then open the pdf_generator.module file with an editor and add the following line at the top after the <?php and use Drupal\Core… lines:

require_once(‘lib/dompdf-dompdf/v0.8.3/autoload.inc.php’);

The above path might differ depending which version of the dompdf library you have.

Then save the file. Go to your website and clear caches and everything should be fine.

In the future when you have to update the PDF generator module to a newer version you must do that manually. Download the module locally, make the same change to the pdf_generator.module file, mount your website’s filesystem, delete the pdf_generator module from your website and copy the local module in its place. Then clear caches of your website again. You might also need to check for database updates by going to https://.web.cern.ch/update.php

AH! Finally I get it! Thank you Sotirios!

It worked and I can indeed proceed with more tries and evaluate the relevance of this tool for our use.
I get your concerns about the sustainability of this practice and this is definitely a caveat to keep in mind as we are looking for easy to maintain, long term solutions. At least, if we can avoid using PDF extracts, this might work.

Best regards,
Philippe