Create a PDF of a signed form

How difficult would it be to take an HTML form that a user has completed, and PDF it?

I am trying to come up with some semblance of a signed contract.

Thanks.

1 Like

Adobe has that covered

1 Like

First, this is for a website, not a desktop. Secondly, I would never pay $400+ for Acrobat Pro.

My hope was there was a free way to do this…

1 Like

relatively easy using FPDF

2 Likes

Could I do it in an afternoon? (I don’t know object-oriented programming.)

1 Like

SitePoint is about to post an article on how to do this with jsPDF. Check it out on Tuesday afternoon PDT if you haven’t found a solution by them.

4 Likes

I’m guessing that requires a knowledge of JavaScript, right?

1 Like

I’m sure that after all this time you’ve picked enough to be able to use it.
It’s not like you’ll need to hack the Core code or anything.

4 Likes

Indeed, yes. :slight_smile:

1 Like

Did you try looking at the tutorials to see what’s involved?

2 Likes

I’m using www.mpdf1.com on a project.

1 Like

No, I figured I would first ask @felgall since maybe he has done it himself.

1 Like

To answer your question, you yourself do not have to write your application in OOP, but FPDF does use classes, so your syntax for interacting with it will be in a OOP style (but you could put all that logic in a single function if you so desire).

You can see an example at
http://www.fpdf.org/en/tutorial/tuto1.htm

2 Likes

Unless you are adding functionality the code will consist of one line to create an object from the FPDF class followed by one line per command to open a document, write each piece of content to it and to output the finished PDF. Apart from the first line and the object reference on the front of the other lines it is effectively a series of function calls.

3 Likes

That is very true. And, you can create a basic template to import into FPDF using Word and Export/Save/Print As PDF, so then all you have to do is load the template, and write the variable data to their locations, then call the FPDF output method.

Here is an example utilizing a template

2 Likes

If I want to take a PHP page which has text and an HTML Form, and make it so when the user submits the form ($_POST) that the webpage and the form contents get turned into a PDF, then is that possible? I don’t have a need to PDF things like MS Word docs or to work with templates - whatever that exactly means.

I am simply looking for a way to in essence do a screenshot of the user’s signed contract - which would be represented by them filling out the Name, Date, and Email fields in the form.

Does that make sense, and would there be a better way to do this?

1 Like

Yes, it is possible using all the above libraries mentioned.

What about this one… http://www.tcpdf.org/

1 Like

FPDF was created because too many people thought that one was too hard to use.

2 Likes

It is my understanding that you have a TOS that has X number of locations the user must “sign and date”. With that in mind, here is how I’d approach your scenario.

Take that TOS and the blank spots and enter it into MS Word. For those blank spots, put underscores to denote where user entered data will go, be sure to leave enough space for long names.

Then Print to PDF (or Save/Export to PDF). You will use that PDF as a template with FPDF, as that way, you don’t have to program the entire TOS wording, you simply refer to the template and the wording gets included automatically.

Finally, you take the Form Post data and you write that on top of the TOS PDF template using FPDF (my prior link will be beneficial to this step, as that is exactly what my code example does)

All in all, you then only have to write X pieces of data to the PDF, instead of an entire TOS, plus the user’s signature and dates. To me, this would be the easiest solution and require the least amount of effort and time.

3 Likes