Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-27-2008, 11:43 AM PDFtk Help
Experienced Talker

Posts: 33
Name: Toby Osbourn
Trades: 0
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($idoffileFDF_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.
tosbourn is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to PDFtk Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12315 seconds with 12 queries