Previous | Next | (P-PDF) Forms & FDF
Topic: fdf_add_template and PHP
Conf: (P-PDF) Forms & FDF, Msg: 77508
From: kyrsa
Date: 11/30/2002 12:45 AM
I've looked at it but It doesn't work.
I've tried to put this line into my program :
fdf_add_template ( $outfdf, False, $pdf_source, "intercalaire", True);
But I always have an error.
If I put this just befor or after the set file, I get this message :
Warning: Error adding template: intercalaire into fdf document in [dir]/fill_pdf.php on line 74
If I post it after the fdfopen, I get this message :
Warning: fdf_add_template(): 1 is not a valid fdf resource in [dir]/fill_pdf.php on line 81
(Of course, I've written $fp or $fdf_out instead of outfdf)
This is my source :
********************************
$pdf_source = "myfile.pdf" ;
$fdf_out = "myfile.fdf" ;
reset ($HTTP_POST_VARS);
$i = 0 ;
while (list ($k, $v) = each ($HTTP_POST_VARS) )
{
$champs[$i] = $k ;
$valeur[$i] = $v ;
$i ++ ;
}
$outfdf = fdf_create();
$j = 0 ;
while ($j < $i )
{ fdf_set_value($outfdf, $champs[$j], $valeur[$j] , 0); }
$j++ ;
}
fdf_set_file($outfdf, $pdf_source);
fdf_save($outfdf, $fdf_out);
fdf_close($outfdf);
// declare application FDF
Header("Content-type: application/vnd.fdf");
// open FDF file
$fp = fopen($fdf_out, "r");
fpassthru($fp);
unlink($fdf_out);
********************************
If you have any idea about how to do it, please, tell me.
I tried also to add a page with fdf_set_javascript_action, but there's no result too ...