Delphi For PHP Forums       


Go Back   Delphi-PHP Forums > Programming > PHP - Code
Forum Jump Register FAQ Members List Downloads Search Today's Posts Mark Forums Read

PHP - Code PHP programming - Ask questions and help people with PHP code. If you are stuck and need help, this is where you ask for help.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 6th January 2010, 22:57
D4PHP User
 
Join Date: Jun 2008
Posts: 34
faber is on a distinguished road
Default Streaming PDF to php page

Is there a way to stream a PDF file to a PHP page? This PDF file would be in a directory that is not web accessible.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 7th January 2010, 01:22
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,272
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

A quick web search brings up:
Unintrusively Streaming Pdf Documents Into A Web Page
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 7th January 2010, 03:43
D4PHP User
 
Join Date: Jun 2008
Posts: 34
faber is on a distinguished road
Default

Found those posts already but it's not what I need. Both solutions posted have to do with converting the PDF to flash or images which is not much of a solution IMO.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 7th January 2010, 13:10
405hp's Avatar
Firebug Fanatic
 
Join Date: Dec 2007
Location: State of Confusion
Posts: 3,272
405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute405hp has a reputation beyond repute
Default

Then I guess I don't understand what you are after.

If you are not trying to view them within your web page you can probably just attach them to in the header and they will open on the users machine.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 8th January 2010, 14:53
D4PHP User
 
Join Date: Jun 2008
Posts: 34
faber is on a distinguished road
Default

Found a solution. Here is what I used:

$filename = $_GET['pdfdoc'];
$pdfcontents = file_get_contents($filename);
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= pdffile.pdf');
header('Content-Transfer-Encoding: binary');
echo $pdfcontents;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT +1. The time now is 22:03.




Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 ©2009, Crawlability, Inc.
Copyright © 2004 - 2009, G&J Solutions Ltd. All Rights Reserved. terms of use