https://www.drupal.org/docs/contributed-modules/entity-print/usage
I need to create a PDF with a custom style for issuing training certificates in courses. This PDF will be printed and has a different style than the rest of my website's theme. I created a content-type "certificates".
After installing the module, create a new "view mode" called "PDF"
It is in the path "/admin/structure/display-modes/view"
Access the content-type that will need to generate the PDF.
In my case: /admin/structure/types/manage/certificates/display/pdf
Move the "View PDF" field from "disabled fields" to the list of visible fields.
Copy the file "entity-print.html.twig" from "modules\contrib\entity_print\templates"
Paste the file into your theme. In my case, it is in "themes\custom\subtheme_barrio\templates\content\entity-print.html.twig"
Create a new file "node--certificates--pdf.html.twig" in "themes\custom\subtheme_barrio\templates\content\node--certificates--pdf.html.twig
This is the file that should be customized according to your needs
If you need to use fields, you can use this format:
{{ content.field_user.0['#title'] }} - if it is a taxonomy
{{ content.field_trainning_date.0['#value']|date('d/m/Y') }} - if it is a smartdate field
In the file "themes\custom\subtheme_barrio\subtheme_barrio.info.yml", add this information:
entity_print: node: # Adds the all-nodes library to all node PDF’s. all: 'subtheme_barrio/print-styling'
In the file "themes\custom\subtheme_barrio\subtheme_barrio.libraries.yml", add this information:
print-styling: version: VERSION css: theme: css/print-style.css: {}
Create a file "print-style.css" in this folder: "themes\custom\subtheme_barrio\css\print-style.css"
Style this file according to your needs
1
2
3
4
5


https://pdf.cloudpros.com.au/print/pdf/node/1/debug
https://www.drupal.org/project/entity_print/issues/2823430#comment-13269130