tags:

views:

186

answers:

3

I have various clients each sending me many pdf templates of application forms. My clients want me to export user information from my database and bind it to the templates.

So for example, I have a pdf called "Fitness Form" and in it are empty fields (text, checkboxes) such as first name, last name, height, weight etc... I need to take all the customer information from my db.t_user table (t_user.first_name, t_user.last_name, t_user.height etc...) and bind it to this pdf template.

Additionally, I'll have a second pdf called "Kickboxing Tournament Application" and in it might be similar fields like first name, last name, height, weight, but it might also have new fields such as wins, losses, technical knockouts etc...

I want a process that allows non-tech savvy people to be able to map columns in my t_user table to these pdf templates. Then they can press a "generate pdf" to fill out all the fields in the pdf template.

At the moment, I'm considering building something with the fpdf library so nontechsavvy people can use Adobe Acrobat to draw bind-able fields in the pdf template. Then I'll create a web application that let's them map fpdf field names to my database column names.

Can anyone recommend a better approach?

A: 

Run your SELECT statement, then: Build your HTML in the manner you see fit, referencing the $row

First Name:

etc for each field in your html that corresponds to each field you pulled from your table

paparush
A: 

I would recreate the PDF in HTML and use wkhtmltopdf to generate the PDF using the HTML template + your data.

You could set them up to use a WYSIWYG to design the HTML and use strings such as {FirstName} they would place to create the replacements.

That's the easy route at least, depends on what you think the user is capable of handling.

Chris Ridenour
A: 

I ended up using adobe's FDF technology to bind data to pdf templates (because clients will not accept any pdf templates that I create from scratch).

John