sscotti
asked on
Displaying PDF embedded in PHP page with "Header", IE issue
I have a PHP page that dynamically displays a PDF page embedded within a PHP using Headers as follows:
<?php
include "database_functions.php";
$query="select * from pdf_files where pid = '".postUrlStringValue('pid ',null)."' ";
$res=mysql_query($query,ge tdbHandle( ));
$row = mysql_fetch_assoc($res);
extract($row);
$filename = str_replace(" ", "_", $name);
if (isset($pdfdata)) {
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-type: application/pdf");
header("Content-Dispositio n:inline; filename=\"$filename\"");
echo $pdfdata;
}
?>
The $pdfdata is actually coming from a database where the pdf is stored, atlhough I could put the pdf files on the server and reference them in the database. I would prefer to keep them in a database though.
The pdf's display fine in Firefox and and Safari, but there is an error in IE where the new window will pup up for a second and then close itself, no data displayed. Wondering if I need to change/adjust the headers, if it is a IE PDF Plug-in issue or what. I did have a statement in there with the strlen($pdfdata) for the size of the file and that did not seem to make any difference.
Thanks.
<?php
include "database_functions.php";
$query="select * from pdf_files where pid = '".postUrlStringValue('pid
$res=mysql_query($query,ge
$row = mysql_fetch_assoc($res);
extract($row);
$filename = str_replace(" ", "_", $name);
if (isset($pdfdata)) {
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-type: application/pdf");
header("Content-Dispositio
echo $pdfdata;
}
?>
The $pdfdata is actually coming from a database where the pdf is stored, atlhough I could put the pdf files on the server and reference them in the database. I would prefer to keep them in a database though.
The pdf's display fine in Firefox and and Safari, but there is an error in IE where the new window will pup up for a second and then close itself, no data displayed. Wondering if I need to change/adjust the headers, if it is a IE PDF Plug-in issue or what. I did have a statement in there with the strlen($pdfdata) for the size of the file and that did not seem to make any difference.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ray,
In this instance I am more interested in actually displaying the pdf inline with a browser plug-in. It works as is in FireFox and Safari on both the Mac and Windows (with plug-in for firefox on Windows). The URL is sscotti.com and just select one of the drop down options to test.
In this instance I am more interested in actually displaying the pdf inline with a browser plug-in. It works as is in FireFox and Safari on both the Mac and Windows (with plug-in for firefox on Windows). The URL is sscotti.com and just select one of the drop down options to test.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Cheers.