form.pdf.fields // For any other help, go to www.pdfhacks.com for the full documentation of this crazy script. There is a helpful tutorial at http://www.mactech.com/articles/mactech/Vol.20/20.11/FillOnlinePDFFormsUsingHTML/index.html, and a working example at http://accesspdf.com/html_pdf_form/ // The rest of the comments were made by the author. require_once( 'forge_fdf.php' ); $fdf_data_strings= array('form1[0].#subform[0].#area[0].LastName[0]' => $pdf_LastName, 'form1[0].#subform[0].#area[0].FirstName[0]' => $pdf_FirstName, 'form1[0].#subform[0].#area[0].EMail[0]' => $pdf_EMail); $fdf_data_names= array(); // funny thing; for our purpose, we can get away with packing everything // everything into fdf_data_strings; that's handy foreach( $_REQUEST as $key => $value ) { // translate tildes back to periods $fdf_data_strings[ strtr($key, '~', '.') ]= $value; } // ignore these in this example $fields_hidden= array(); $fields_readonly= array(); $fdf= forge_fdf( '', $fdf_data_strings, $fdf_data_names, $fields_hidden, $fields_readonly ); $fdf_fn= tempnam( '.', 'fdf' ); $fp= fopen( $fdf_fn, 'w' ); if( $fp ) { fwrite( $fp, $fdf ); fclose( $fp ); header( 'Content-type: application/pdf' ); header( 'Content-disposition: attachment; '. 'filename='.$pdf_FirstName.$pdf_LastName.'LoanAgreement.pdf' ); passthru( 'pdftk LoanAgreement.pdf fill_form '. $fdf_fn. ' output - flatten' ); unlink( $fdf_fn ); // delete temp file } else { // error echo 'Error: unable to write temp fdf file: '. $fdf_fn; } ?>