Sending emails with attachments is a common requirement for any website. Entity print is a widely popular module that helps to export any Drupal entities as PDFs instantly. Using this module, users can either download an entity as pdf or view the entity as PDF in their browser instantly.
However, in some cases, you might want to send the PDF version of a node/entity as an attachment in an email to the user. Entity print module does not support this out of the box. But we can easily reuse the services provided by the module to build this functionality.
Prerequisites
The Goal
Any node can be instantly downloaded as a PDF by accessing the path /print/pdf/node/[node_id] using the Entity print module. We plan to extend this functionality and build a custom module that will
The Plan
The Implementation
Verify the Result
A Quick Recap
Hope this blog has given you a basic understanding of how to export a node as a PDF and attach it to emails. Here is an overview of all the things covered in this blog.
GitHub URL