I've been using the advice given in this question:
Merge FDF data into a PDF file using PHP
to determine how I can pre-populate a pdf form with data pulled from a database but not getting the data to file. I'm running php 5.3.15 on Mountain Lion and I'm using the following link to combine the pdf with the fdf on a table page that I'd like to allow the user to click and take them to a populated pdf file:
something.pdf#FDF=generatePdf.php
The generatePdf.php looks like this:
<?php
$pdf_form_url= "";
require_once('forge_fdf.php');
$fdf_data_names= array(); // none of these in this example
$fdf_data_strings= array(); // none of these in this example
$fdf_data_strings['form1[0].#subform[0].q1a_LastName'] = "Smith";
$fields_hidden= array();
$fields_readonly= array();
// set this to retry the previous state
$retry_b= false;
header( 'content-type: application/vnd.fdf' );
echo forge_fdf( $pdf_form_url,
$fdf_data_strings,
$fdf_data_names,
$fields_hidden,
$fields_readonly );
?>
and the FDF file looks like this when I run it through the pdftk command line:
FieldType: Text
FieldName: form1[0].#subform[0].q1a_LastName[0]
FieldNameAlt: Enter Family Name
FieldFlags: 0
FieldJustification: Left
FieldMaxLength: 35
Still, when I run it the form doesn't auto populate. I've tried many variations including just using the q1a_LastName by itself and I still end up with an empty form. The forge_fdf.php is in the same directory.
Update: I've also attempted the conventional method outlined in the Merge FDF data into a PDF question that I've linked to using PHP, meaning I didn't just direct the user to a pdf file but also attmepted to have the user download the pdf. In that particular case, I would receive a message saying the pdf was empty. I've checked the created raw FDF file and it appears to be populating with data. In either case, I'm not getting what I need.