pdf file not opening

TonyReba
TonyReba used Ask the Experts™
on
I am able to open the file when testing the web site I created, but some of the users are having the following error:

There was an error opening this document. The file cannot be found.

I tested on my computer which has adobe acrobat pdf pro X , and all works fine, however the users are not being able to open the created pdf file

Any ideas what could be happening?

<?php
/*
Note that this line: /F (http://www.mysite.com/CompletionForm.pdf)
determines the PDF File to be filled in. 
*/

$txtName       = $_GET['txtName'];
$txtCourseName = $_GET['txtCourseName'];
$txtCompletionDate = $_GET['txtCompletionDate'];
//FOR TEST

//echo $txtName;
//echo $txtCourseName;


header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public"); 
header("Cache-Control: private",false); 
header("Content-Description: File Transfer");
header("Content-type: application/vnd.fdf");

echo <<<EOT
%FDF-1.2
1 0 obj
<<
/FDF
<< 
/Fields
[ 
<<
/T (txtName)
/V ({$txtName})
>> 
<<
/T (txtCourseName)
/V ({$txtCourseName})
>> 
<<
/T (txtCompletionDate)
/V ({$txtCompletionDate})
>> 
]
/F (http://appdevelsvr:8080/shquiz/media/certificate/SH_CertificateofCompletion.pdf)

>> 
>>
endobj
trailer
<<
/Root 1 0 R
>>
%%EOF
EOT;

?>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Install Adobe Reader on their computer and try again.

Author

Commented:
I cannot do that since there is 1000+ computers and not everyone can have access to reader adobe.

Can you look at the code I posted, meabe there is a way to have this be compatible with other adobe versions?
Marco GasiFreelancer
Top Expert 2010

Commented:
"there is 1000+ computers and not everyone can have access to reader adobe. "

But if they have not access to Adobe Reader, they can't read pdf files! At least, they need some third party pdf reader...

OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Author

Commented:
Some of them have adobe reader, but is an old version, but that still doesnt allow them to open the file I think they have 8 , and I wrote the pdf on X..


F IgorDeveloper

Commented:
if the file is downloaded via a script that generate the pdf file
(is not downloaded directly using the url to the pdf file)
you may be get a HTTP headers problem  (generally in IE6-7) .

note that the content-type you are using is:

header("Content-type: application/vnd.fdf");

and the content is a FDF file

Try adding a "Content-disposition" header to name the file


Author

Commented:
What kind of disposition.  Can u send me the line I meed to add
Developer
Commented:
header("Content-disposition: attachment; filename=document.fdf");

Author

Commented:
Do I need to tell the path of the pdf?

I have the file on

http://appdevelsvr:8080/shquiz/media/certificate/SH_CertificateofCompletion.pdf

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial