1

I need to attach custom css library so entity_print module uses it to generate the final PDF.

The goal is to get custom css effect the generated PDF at /print/pdf/node/{{NID}}

I have set the PDF engine to mpdf under entity print configuration

I tried the following 2 methods unsuccessfully :

  1. Attach to node.html.twig file using {{attach_library('THEMENAME/library_name')}}

  2. Attach it to entity_print at THEMENAME.info.yml file per described at https://www.drupal.org/node/2706755

I don't see the attached css at /print/pdf/node/{{NID}}/debug when inspecting elements

Any help or pointers are appreciated.

2

I am answering my own question for the ones who might probably face similar issues.

The 2nd method as described at https://www.drupal.org/node/2706755 where we attach the library to entity_print works.

I had a custom entity-print--node.html.twig in which I missed printing the css styles using the variable {{ entity_print_css }}

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.