Send an pdf with button

21 December, 2021 07:05:07
ACM
Topics: 9
Messages: 35
I would like to create a button that sends an email to a recipient (s) an attached pdf file created in the e2pdf module.
How should it be?

Thanks
21 December, 2021 08:14:24
E2Pdf
Support
Topics: 7
Messages: 3188
Hi,

If you need to generate PDF attachment for WordPress Page/Post, unfortunately E2Pdf doesn't have such functionality by default.

You can try to create custom functionality with PHP. It can be some custom ajax function which will gather email and post id for which it must be generated PDF. After calling this function it must be called something like this: https://codeshare.io/eVm807. PHP knowledge and further modification will be required to set dynamic Post/Page ID and needed email.

As an alternative you can try to to use for example Formidable Forms which will gather email, and Post ID/Page ID in "hidden" field. Inside Formidable Forms mail action it must be used something like. Mail action can be set to send email to submitted recipients which was filled upon form submission and mail body must contain:

[e2pdf-attachment id="213" dataset="[1461]"]

* 213 - is the E2Pdf Template connected to needed WordPress Post/Page Type.
** [1461] - is the "hidden" field which has default value as [post_id]

P.S. It must be also used any custom text ("Test" in example) in "mail" body as it can be sent empty email.

Some screenshots for 2nd solution attached.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
27 December, 2021 05:35:39
ACM
Topics: 9
Messages: 35
Thanks I have do a function ajax for this thanks
It's work for me