Saving a FDF merge as a PDF to server
| From: | Herhuth, Ron | Date: | Tue, 26 Nov 2002 18:22:24 +0000 |
| Subject: | Saving a FDF merge as a PDF to server | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-17150@lists.php.net to get a copy of this message | ||
I have successfully created a web app that fills a FDF Tax form out with
data from MSSQL. However there seems to be a dependency that is created
between the PDF form I saved with PHP (the filled out tax form) onto the
server and the template PDF (template tax form). I ideally would like to
email the completed tax form as a PDF to the individuals but I can't do it
without sending the template with it.
Am I missing something?
Here is an excerpt of the code I'm using:
// CREATE ARRAY OF FORM FIELDS AND ASSIGN DATA TO THE CORRECT FIELDS
$pdf_data = array(
"f1-1"=>$date1,
"f1-2"=>$date2,
"f1-3"=>$date3,
"f1-4"=>$ssNum,
"f1-5"=>$name,
"f1-6"=>$corpID1,
"f1-7"=>$corpID2,
"c1-5"=>"On",
"f1-8"=>$divisionAddress,
"f1-15"=>$preparer,
"f1-18"=>$payments,
"f1-35"=>$contrib401k,
"f1-112"=>$IDs,
"f2-28"=>$supplemental1,
"f2-29"=>$supplemental2);
// FILL IN FIELDS WITH DATA
$fdf = "%FDF-1.2\n%????\n";
$fdf .= "1 0 obj \n<< /FDF ";
$fdf .= "<< /Fields [\n";
foreach($pdf_data as $key => $val)
$fdf .= "<< /V ($val)/T ($key) >> \n";
$fdf .= "]\n/F ($pdf_template) >>";
$fdf .= ">>\nendobj\ntrailer\n<<\n";
$fdf .= "/Root 1 0 R \n\n>>\n";
$fdf .= "%%EOF";
// CREATE FILENAME
$filename = $row['First_Name'] . $row['Last_Name'] . "_" .
$row['Tatum_ID']
. ".pdf";
// CREATE PDF
$fdffp = fopen($filename, "w");
fwrite($fdffp, $fdf, strlen($fdf));
fclose($fdffp);
Should I be using something different to save the resulting file?
Thanks!
Ron