2

Has anyone come across a situation where the following process is required:

  1. HTML form is completed on website
  2. Form gets submitted
  3. PDF of form details is created
  4. Generated PDF is emailed to a specified admin email address

How did you go about it, what plugins (if any) did you use?

Thanks.

2

I believe a number of add-ons, like Exp:resso's Store, that automate the creation of PDF files, use DOMPDF: an HTML to PDF converter. It can be called directly with PHP for use in ExpressionEngine or you can take a look at Patrick Pohler's PDF Press.

I haven't used PDF Press, it's pretty new, but with the exception of the one issue with Unicode Characters, that has been fixed/address, I haven't really heard any complaints about it. It's probably the simplest method for adding DOMPDF functionality to your website, if you don't like delving into PHP or just don't want to turn PHP on in your templates for security reasons.

There are other PDF converter plugins, but most use something like PDF Crowd. PDFCrowd is free for single use or small amounts (up to 100 PDF files), but have a monthly charge if you need to create more than that or have an unknown amount of data, say submission of web forms (you could get 5, 500, or 5000 forms submitted).

As for sending the PDF as an email… you'd probably need to figure out which PDF solution you are going to use first, then you can explore various notification and email solutions like Postmaster or MX Notify. Though admittedly, I'm not certain why you wouldn't just send an HTML formatted email, with a link where a PDF could be generated if needed.

| improve this answer | |
  • @nonprofit-tech // thanks for your suggestions. at this stage we haven't started on implementation. just curious how others would/have approached a similar situation. – Mike Dexter Mar 8 '13 at 1:53
0

We accomplished this in the past with our own code. PDFLib was the PHP library we used. FPDF is another.

These libraries allow you to create a PDF offline as a template, and then, using PHP, lot your content in the PDF and apply formatting.

Form gets submitted

You didn't indicate how you were submitting the form. If you're using Freeform, there's a post-submit hook that will allow you to encapsulate your PDF logic in an extension and run that extension any time the form is submitted.

If you're using Safecracker you can set your redirect page to be a post-processor page in your templates. Enable PHP on output for that template, pass the new entry ID on the URL, and use that to get the entry's details. If you have PHP set to run on output, you can pass the entry's values into PHP to bundle into the email.

You'll want to generate and save the PDF to the server, and then use the Email class to build and send your email with the PDF attached.

With all that said, I agree with nonprofit_tech: Why not send the email with a link to the PDF, or just send the details right in email?

I covered our work with PDFs in https://expressionengine.stackexchange.com/a/6154/293 as well.

| improve this answer | |
  • @mark-j-reeves // thanks for your suggestions and the link to your own experience. at this stage we haven't started on implementation. just curious how others would/have approached a similar situation. – Mike Dexter Mar 8 '13 at 1:55
0

Much earlier, I did it for Channel Entry Form and FreeForm by developing an extension. On submitting the form, the extension generate PDF (with TCPDF/FPDF) and that generated PDF will be sent as attachment to provided email address.

This process seemed me pretty simple and did everything.

I hope, this approach would help you. Please let me know if I can share more idea.

| improve this answer | |
  • is it possible to buy this extension? – worfoual May 15 '14 at 8:19
  • @worfoual I developed that extension for a specif client so it not available to buy. If you would like, I can assist you for the same. – Bhashkar Yadav May 16 '14 at 17:24

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.