Inserting pdf in emails and pages

4 April, 2021 22:05:20
jorgellomb98
Topics: 2
Messages: 5
Hello,
I have a series of questions regarding the possibilities of inserting the dynamically generated pdfs in emails and pages:

-Is it possible to insert on a web page a link to download the dynamically generated pdf? how?

-How do I add the newly dynamically generated pdfs to automated emails sent to customers ? (in this case, I would do so with quiz and survey master). This quiz-maker plugin gives the possibility of sending automated emails on quiz completion. I would like to attach the pdfs generated with e2pdf to these emails. I know that e2pdf is not compatible/integrated with this plugin, I came up with a workaround though, I would fill a WP page with the desired data from the completed quiz (by using javascript) and then generate the pdf with e2pdf from that page. Would all of this be possible?

Thank you !
4 April, 2021 23:28:53
Oleksandr
Support
Topics: 5
Messages: 1997
Hi,

I'm aware that it would require PHP knowledge and to build the correct logic to make it work, however it can be some issues if you need data from the quiz, as if it can change data on page only via JavaScript it will not work.

1. By default if E2Pdf Template connected to "WordPress" extension and correct "Post Type" can generate PDF automatically in place where [e2pdf-download id="1"] shortcode placed. It will use Post ID where shortcode placed (if theme using default WordPress functionality). However we are not sure if it will fit your needs as E2Pdf works with data which is saved, and not dynamic page data. If the post will be changed only via JavaScript, it will not work as this data will not be changed in backend/database. It's also possible to generate download link for example if "Post Type" is different from the connected to E2Pdf Template by defining dataset as [e2pdf-download id="1" dataset="2"], where "2" is the Post ID for which it must be generated PDF download link.

If it's some PHP template, it's also possible to generated download link via PHP code:

$post_id = "2"; // define Post ID for which it must be generated PDF download link
echo do_shortcode('[e2pdf-download id="1" dataset="'. $post_id .'"]');

2. Unfortunately the only way is to use quiz-maker plugin hooks, generate PDF via PHP and add it to attachments on mail sending.

For example it can be used current code via PHP:

$post_id = "2"; //define Post ID for which it must be generated PDF
$pdf_path = echo do_shortcode('[e2pdf-attachment id="1" dataset="'. $post_id .'" apply="true"]');

$pdf_path will contain file path to temporary generated PDF which can be added to mail attachments, after sending email it must be added code to remove this temporary attachment.

We remain at your service.
If you appreciate our support , we would really appreciate your feedback at WordPress.org!
5 April, 2021 03:43:38
jorgellomb98
Topics: 2
Messages: 5
Hello,
Thank you for the fast answer.
Okay, I see it is a bit of a complicated and almost impossible solution.
I would like to ask about a different workaround:

I am thinking about using any forms plugin compatible with e2pdf, for instance, let's say gravity forms. The idea is to send the dynamically generated PDFs as an attachment to the emails sent to the users on form submission by, in this example, gravity forms. So my questions are the following:

-Is it possible to generate PDFs longer than just 1 page right?. In this case, I would like to send a 20-40 page-long report/pdf. Could I still design them with the drag-and-drop PDF builder?

-Is it possible to attach these PDFs to the emails sent with gravity forms on form submission?. How?. I really need to know how.

My new idea is to get the results of the quiz with javascript code, then put these numeric results in one or two input fields in the gravity form with javascript. These fields will be hidden to the user with JS and CSS, thus they will never see the automatically placed inputs. However, the data in these fields will be accessible by e2pdf builder, with which I will be able then to build the PDFs with the results of the quiz. Do you think this could work?. I don't see any downsides.

Thank you very much for the excellent support

5 April, 2021 04:46:02
Oleksandr
Support
Topics: 5
Messages: 1997
Yes, such solution can work actually.

- Yes, it's possible to create PDFs longer that just 1 page, however any paid plan License Key will be required. Unfortunately this is the limitation of "FREE" version.

- Yes, it's possible. It must be used just [e2pdf-attachment id="1"] inside Gravity Forms mail body, where 1 is the ID of E2Pdf Template connected to needed form. In this case it will automatically generate PDF and attach it to mail. Screenshot attached. If you have already Gravity Forms you must be able to test it with "FREE" version. Attachments work the same way also with other forms like Formidable Forms, Forminator, Divi Contact Forms.

We remain at your service.
If you appreciate our support , we would really appreciate your feedback at WordPress.org!
5 April, 2021 05:26:37
jorgellomb98
Topics: 2
Messages: 5
Perfect,
thank you very much for such an excellent customer support.
You have gained a new client :D haha
Thank you !