Using Breezing Forms form data to fill a PDF form

1.8k Views Asked by At

I have successfully created 3 Breezing Forms forms on a Joomla site and would like to know the best way to use the form data saved to the database to fill a PDF form, then be emailed to a specific address as a final step when the form is completed by the user. I'm aware that with Breezing Forms you can export form data to PDF, but the my forms are too complex in layout for the format of that type of export. What I need is the form data to populate a formatted PDF form.

Here is an example of one of the forms and the PDF it should fill: Form: http://www.nutriworkscnc.com/Development/index.php?option=com_breezingforms&view=form&Itemid=640 PDF: http://www.nutriworkscnc.com/Development/images/forms/history.pdf

2

There are 2 best solutions below

0
On

If you want to solve this by using PHP you may take a look at the SetaPDF-FormFiller component (not free!). With it you can fill the fields through a very simple interface:

// Create an http writer
$writer = new SetaPDF_Core_Writer_Http("filled.pdf");
// Load document by filename
$document = SetaPDF_Core_Document::loadByFilename("history.pdf", $writer);

// Initiate a form filler instance
$formFiller = new SetaPDF_FormFiller($document);
// Get the fields instance
$fields = $formFiller->getFields();

// fill in the fields
$fields["Client Name"]->setValue("Test Person");
$fields["Address street"]->setValue("Teststreet 1");
$fields["Address city zip"]->setValue(12345);
$fields["diabetes"]->setValue(true);
$fields["diar"]->setValue(true);

// done
$document->save()->finish();
0
On

You essentially have two ways to fill the PDF form: client-side and server-side.

For client-side filling, you would create a FDF file with the /F key pointing to the base PDF (some people would call that the Template file). Then you would send the FDF to the user and a savvy PDF viewer would then load the base PDF and fill it.

If you have to serve dumb PDF viewers, you'd have to rely on server-side filling. For that, there are applications, such as FDFMerge by Appligent, or libraries, such as iText. You then will have to prepare the data in an appropriate way for your server-side filling tool.