CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 ::: PDF Streaming

Print topic Send  topic

Author Message
klwillis


Posts: 428
Posted: 08/06/2007, 3:47 PM

The following code will ask whether the PDF should be saved or not,
but what I'd prefer is if the PDF would be viewed (embedded) within
the web browser.

I'm using Internet Explorer v6.x, and Adobe Reader v7.0.8

Any ideas on the needed fix to view the PDF embedded would be appreciated:

$fn = "sample.pdf";
$fp = fopen($fn, "r");
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=$fn");
header("Content-Length: " . filesize($fn));
header("Content-Transfer-Encoding: binary");
fpassthru($fp);
fclose($fp);
_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
datadoit.com
Posted: 08/06/2007, 5:19 PM

klwillis wrote:
> The following code will ask whether the PDF should be saved or not,
> but what I'd prefer is if the PDF would be viewed (embedded) within
> the web browser.
>
> I'm using Internet Explorer v6.x, and Adobe Reader v7.0.8
>
> Any ideas on the needed fix to view the PDF embedded would be appreciated:
>
> $fn = "sample.pdf";
> $fp = fopen($fn, "r");
> header("Pragma: public");
> header("Expires: 0");
> header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
> header("Cache-Control: public");
> header("Content-Description: File Transfer");
> header("Content-type: application/pdf");
> header("Content-Disposition: attachment; filename=$fn");
> header("Content-Length: " . filesize($fn));
> header("Content-Transfer-Encoding: binary");
> fpassthru($fp);
> fclose($fp);
> _________________
> Kevin Willis
> ---------------------------------------

Perhaps try this:

$fn = "sample.pdf";
echo "<HTML><SCRIPT>document.location='$fn';</SCRIPT></HTML>";

Also make sure Adobe Reader is set to display in the browser (look under
Edit->Preferences->Internet).
klwillis


Posts: 428
Posted: 08/06/2007, 6:51 PM

For security, the PDF document will not be accessable through a URL.
(I forgot to mention that in my first post)

I'll take a look at the Adobe Reader preferences section.

Thanks.

Quote datadoit.com:
klwillis wrote:
> The following code will ask whether the PDF should be saved or not,
> but what I'd prefer is if the PDF would be viewed (embedded) within
> the web browser.
>
> I'm using Internet Explorer v6.x, and Adobe Reader v7.0.8
>
> Any ideas on the needed fix to view the PDF embedded would be appreciated:
>
> $fn = "sample.pdf";
> $fp = fopen($fn, "r");
> header("Pragma: public");
> header("Expires: 0");
> header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
> header("Cache-Control: public");
> header("Content-Description: File Transfer");
> header("Content-type: application/pdf");
> header("Content-Disposition: attachment; filename=$fn");
> header("Content-Length: " . filesize($fn));
> header("Content-Transfer-Encoding: binary");
> fpassthru($fp);
> fclose($fp);
> _________________
> Kevin Willis
> ---------------------------------------

Perhaps try this:

$fn = "sample.pdf";
echo "<HTML><SCRIPT>document.location='$fn';</SCRIPT></HTML>";

Also make sure Adobe Reader is set to display in the browser (look under
Edit->Preferences->Internet).

_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
lwismanuel


Posts: 39
Posted: 08/06/2007, 9:56 PM

klwillis, try commenting out
header("Content-Disposition: attachment; filename=$fn");
View profile  Send private message
klwillis


Posts: 428
Posted: 08/07/2007, 8:03 AM

I thought that once also, but it still attempts to download the PDF.

Quote lwismanuel:
klwillis, try commenting out
header("Content-Disposition: attachment; filename=$fn");


_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
klwillis


Posts: 428
Posted: 08/07/2007, 8:20 AM

I upgraded to Adobe Reader 8 - makes no difference - PDF still get's downloaded
instead of displayed in the browser.

Does anyone know of a FLASH (preferrably) or Active-X plugin which will embed PDF docs within the browser for viewing?

Quote klwillis:
I thought that once also, but it still attempts to download the PDF.

Quote lwismanuel:
klwillis, try commenting out
header("Content-Disposition: attachment; filename=$fn");



_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
datadoit.com
Posted: 08/07/2007, 8:37 AM

klwillis wrote:
> I upgraded to Adobe Reader 8 - makes no difference - PDF still get's downloaded
> instead of displayed in the browser.
>
> Does nayone know of a FLASH (preferrably) or Active-X plugin which will embed
> PDF
> docs within the browser for viewing?
>
-----------------------------

This looks pretty slick: http://view.samurajdata.se/
klwillis


Posts: 428
Posted: 08/07/2007, 9:27 AM

Nice, but it actually needs to create a set of tables within MySQL, along with creating
converted versions of the PDF documents - something I don't want.

Quote datadoit.com:
klwillis wrote:
> I upgraded to Adobe Reader 8 - makes no difference - PDF still get's downloaded
> instead of displayed in the browser.
>
> Does nayone know of a FLASH (preferrably) or Active-X plugin which will embed
> PDF
> docs within the browser for viewing?
>
-----------------------------

This looks pretty slick: http://view.samurajdata.se/

_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message
datadoit.com
Posted: 08/07/2007, 10:53 AM

If you have a deep wallet:

http://www.daeja.com/
klwillis


Posts: 428
Posted: 08/07/2007, 12:29 PM

I resolved the problem (under Internet Explorer) by streaming the PDF within an inline-frame.

The inline-frame "forces" the content to be embedded within the browser.


_________________
Kevin Willis, VP/CIO
HealthCare Information Technology Specialist
http://www.nexushealthcare.com
"Fast - Convenient - Quality-Care"

Medical Software Consulting Services
Email : klwillis@nexushealthcare.com
Skype : klwillis2006
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.