I have a pre-existing PDF form that is populated through a MySQL database. I am using FDF. I need to insert a dynamic image into the PDF. Does anyone have any information on how to do this.
I need to know what I need to do to my PDF file and PHP file in order to do this. I have found some resources but they all involve PHP coding that builds a PDF file from scratch and I don't want to do this, the PDF is pre-existing. Any help would be great.
Here is my PHP code (which is working fine for the dynamic text portion):
$data['name'] = $row["name"];
$data['phone'] = $row["phone"];
$data['photolocation'] = "images/test.jpg";
require_once 'createFDF.php';
$fdf_file_bwc=$id.'_bwc.fdf';
// the directory to write the result in
$fdf_dir_bwc='/home/public_html/ratesheets';
// need to know what file the data will go into
$pdf_doc_bwc='intranet/rates.pdf';
// generate the file content
$fdf_data_bwc=createFDF($pdf_doc_bwc,$data);
// this is where you'd do any custom handling of the data
// if you wanted to put it in a database, email the
// FDF data, push ti back to the user with a header() call, etc.
// write the file out
if($fp_bwc=fopen($fdf_dir_bwc.'/'.$fdf_file_bwc,'w')){
fwrite($fp_bwc,$fdf_data_bwc,strlen($fdf_data_bwc));
}else{
die('Unable to create file');
}
fclose($fp_bwc);