Avatar of TonyReba
TonyRebaFlag for United States of America

asked on 

pdf file not opening

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

PHPAdobe AcrobatJoomla

Avatar of undefined
Last Comment
TonyReba
Avatar of Tyler Laczko
Tyler Laczko
Flag of Canada image

Install Adobe Reader on their computer and try again.
Avatar of TonyReba
TonyReba
Flag of United States of America image

ASKER

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?
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

"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...

Avatar of TonyReba
TonyReba
Flag of United States of America image

ASKER

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..


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


Avatar of TonyReba
TonyReba
Flag of United States of America image

ASKER

What kind of disposition.  Can u send me the line I meed to add
ASKER CERTIFIED SOLUTION
Avatar of Francisco Igor
Francisco Igor
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of TonyReba
TonyReba
Flag of United States of America image

ASKER

Do I need to tell the path of the pdf?

I have the file on

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

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo