I am not 100% sure this really belongs in the PHP section, however PHP is what the PDFtk stuff is being accessed in!
Basically this is what was being used in a system I need to fix up, only this section (downloading a document as a PDF) never really worked. (the joy!)
When the file downloads no PDF reader will touch it because of an error (just a general file is corrupt error appears), however whenever I download the fdf file created by code, open it and then manually add the PDF file, it opens and everything syncs up!
So my question is this, is the PDFtk call at fault, I don't think it is (below is the code to confirm..) and if it isn't, what else would cause a corrupt download?
PHP Code:
// "Temporary File"; $idoffile = "temp/".md5(time()).".fdf";
$nullarray = array(); file_put_contents($idoffile, FDF_File($PDF_File, $FDF_Pairs)); // Store temporary FDF
passthru( '/usr/local/bin/pdftk '.$PDF_File.' fill_form '.$idoffile.' output - flatten' ); // use pdftk to combine pdf with fdf and flatten
header( 'Content-type: application/pdf' ); // Tell client we are a pdf if (isset($_GET["downOnly"])){ header( 'Content-disposition: attachment; filename=riddor_'.$_DOC['AccID'].'.pdf' ); // We want to download so try force }
Any help would be greatly appreciated.
Last edited by tosbourn; 08-27-2008 at 11:53 AM..
Reason: Changing code tags to php tags.
|