Jump to content

fdf


jakebur01

Recommended Posts

I set up a pdf document with form fields and a submit button that will submit html to a php document which generates a .fdf document.  All this is working, but when I call the .fdf document up in the browser, it then redirects me the .pdf.  I get "404 page not found", but when I hit "refresh" the .pdf loads fine with the .fdf data pluged in.

 

Any ideas?

 

create pdf function

function createFDF($file,$info){
    $data="%FDF-1.2\n%âãÏÓ\n1 0 obj\n<< \n/FDF << /Fields [ ";
    foreach($info as $field => $val){
    	if(is_array($val)){
        	$data.='<</T('.$field.')/V[';
        	foreach($val as $opt)
        		$data.='('.trim($opt).')';
        	$data.=']>>';
    	}else{
        	$data.='<</T('.$field.')/V('.trim($val).')>>';
    	}
    }
    $data.="] \n/F (".$file.") /ID [ <".md5(time()).">\n] >>".
        " \n>> \nendobj\ntrailer\n".
        "<<\n/Root 1 0 R \n\n>>\n%%EOF\n";
    return $data;
}

 

Here is one of the generated .fdf documents:

%FDF-1.2
%âãÏÓ
1 0 obj
<< 
/FDF << /Fields [ <</T(business_name)/V(Test Company)>><</T(p1)/V(Yes)>><</T(p2)/V()>><</T(business_address)/V(123 Test Drive)>><</T(city)/V(Test City)>><</T(state)/V(TE)>><</T(zip)/V(12345)>><</T(business_mailing)/V(Test Business Address)>><</T(nearest_stores)/V(Test Nearest Store)>><</T(business_phone)/V(555-123-1234)>><</T(fax_number)/V(555-123-1233)>><</T(federal_id)/V(12-1234442)>><</T(owner)/V(Test Owner)>><</T(contact_name)/V(Test Contact Name)>><</T(home_address_1)/V(Test Home Address)>><</T(home_address_2)/V(Test Home Address 2)>><</T(ss)/V(111-22-22222)>><</T(home_phone)/V(222-111-2234)>><</T(drivers_lic)/V(2324235235425)>><</T(c1)/V(Yes)>><</T(c2)/V()>><</T(c3)/V()>><</T(c4)/V()>><</T(bank_name)/V(Test Bank Name)>><</T(bank_address)/V(Test Bank Address)>><</T(bank_city)/V(Test City)>><</T(bank_state)/V(TE)>><</T(bank_zip)/V(13498)>><</T(bank_phone)/V(444-444-2323)>><</T(checking_account)/V(3203o4iu2)>><</T(bank_officer)/V(Test Officer)>><</T(sig)/V(Test Sig)>>] 
/F (http://www.mysite.com/credit_application.pdf) /ID [ <5d8a41ab0ddaf80840cd79d7f1a57db9>
] >> 
>> 
endobj
trailer
<<
/Root 1 0 R 

>>
%%EOF

 

 

Link to comment
https://forums.phpfreaks.com/topic/229146-fdf/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.