3

Good day all

I am busy converting a school's paper-based application forms to online forms. I've created all the steps of the form on php and linked all textboxes to MySQL to create tables with the values in.

On the last step of the form, the review step, the user can see all his/her info that they entered. After all the info is a "Send" button. Once the user clicks on the send button, the application is sent and saved.

How can I code a PDF document to be emailed to a specific recipient, with the values in a specific Design (meaning it should replicate the paper-based forms)?? Any advice?

3 Answers3

0

This is a very broad question- I have looked into doing this for a security risk assessment form before. There is not a sure fast way to script an export to pdf. Not without calling some external functions. The only way I know how this is possible is to create an event handler (JS) using some pre-built functions:

https://parall.ax/products/jspdf

This is one library- but there are many to try and find one that has a function that fits your needs best. PDF generating and scripting is done client side from what I can see- your going to need to work with a client side language. Google is your friend.

Charles
  • 305
  • 1
  • 3
  • 15
0

You are hoping to do three things:

  1. Gather the data using an ordinary web application.
  2. Insert that data into a PDF form that has been created to match a paper form.
  3. Serialize and transmit the resulting PDF to somebody by email.

You have done the first of these things. The third of them is quite simple, once you have the file you want to send.

The second one is difficult. You have two choices.

  1. Write a program in your favorite programming language to generate a pdf that replicates your paper form. This is an incredibly tedious task, but you can do it, line by line and text string by text string. Look up the PDF api inside php. http://php.net/manual/en/book.pdf.php

  2. Use Adobe Acrobat to create the form. You can scan the paper form and then insert form fields in the appropriate places. You can test the form, edit it, and make sure it is correct using Acrobat. (Notice that an Acrobat form is not just a PDF document; it has fillable form fields). Then, once you have a good form, you can write some software to fill in the fields of that form and save the result.

The second process will give you a professional looking result, but you'll have to spend money on a full copy of Acrobat (or some other forms-capable PDF tool).

So, once you have a nice pdf form, with named form fields, to use as a template, the steps are:

O. Jones
  • 103,626
  • 17
  • 118
  • 172
0

2 ways of skinning this, the first touched on before is to create an fdf file (with your mysql fields), this can be combined with a pdf file that has form fields in it to give you your flat file pdf file with the values in. Look here for this. https://github.com/mikehaertl/php-pdftk

You will need something like adobe acrobat 9, or a later version to edit the pdf files you have.

Another way, create the file in html then use mpdf to convert it to pdf.

Either way you will then have your pdf, with regards emailing. Just go for phpmailer - will give you the ability to attach files in an email with no hassel.

Richard Housham
  • 1,525
  • 2
  • 15
  • 31