Re: [PHP] Finally, PDF Header for PDF stuffs that work....
IE just don't work depending on some of the IE's version because of the IE's countless bugs. So, a different method of controlling the data output to the browser is needed. That's when I use the fopen() stuffs and it solve the problem. It is evident by reduced customer's calling tech support (us)... Questions about IE problem is something you would have to ask M$ on why it is using hte faulty IE. Scott F. Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Scott Fletcher ([EMAIL PROTECTED]): //Can't use readfile() due to poor controlling of the file download. //(IE have this problems)... //readfile($filepath); readfile has no effect on how IE handles downloads. //use fopen() instead of readfile... $fp = fopen($filepath, 'rb'); $pdf_buffer = fread($fp, $filesize); fclose ($fp); print $pdf_buffer; Loading the whole file in memory and not doing anything with it before sending it to the client doesn't make much sense. //Required, to keep IE from running into problems //when opening the file while downloading or downloading... //(IE been acting strange...) exit(); This also doesn't effect IE. Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finally, PDF Header for PDF stuffs that work....
OK, here's a different problem. If I call a pdf file directly, the Acrobat plugin begins to display the file almost immediately. Here is the reponse header for calling the file directly: HTTP/1.1 200 OK Date: Thu, 16 Oct 2003 20:41:28 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b PHP/4.3.3 mod_perl/1.26 X-Meta-MSSmartTagsPreventParsing: TRUE X-MSSmartTagsPreventParsing: TRUE Last-Modified: Thu, 16 Oct 2003 17:08:17 GMT ETag: 94174-341fcb-3f8ed081 Accept-Ranges: bytes Content-Length: 3416011 Connection: close Content-Type: application/pdf I wrote a pdf-serving script for anti-leech purposes, and it works fine, except that the acrobat plugin waits for the entire file to come down the pipe before anything is displayed. The mystery for me is that the headers--the important ones anyway--look exactly the same. Dig: HTTP/1.1 200 OK Date: Thu, 16 Oct 2003 20:44:45 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b PHP/4.3.3 mod_perl/1.26 X-Meta-MSSmartTagsPreventParsing: TRUE X-MSSmartTagsPreventParsing: TRUE X-Powered-By: PHP/4.3.3 X-Accelerated-By: PHPA/1.3.3r2 Accept-Ranges: bytes Content-Length: 3416011 Connection: close Content-Type: application/pdf Here's what's serving the file: header(Content-Type: application/pdf); header(Accept-Ranges: bytes); header(Content-Length: .filesize($thefile)); readfile($thefile); Can anybody tell me why the browser is waiting for the entire file before it's displayed(using php)? I don't think the average user will have the patience to stare at a blank browser waiting for the file. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finally, PDF Header for PDF stuffs that work....
* Thus wrote John Herren ([EMAIL PROTECTED]): header(Content-Type: application/pdf); header(Accept-Ranges: bytes); header(Content-Length: .filesize($thefile)); readfile($thefile); Can anybody tell me why the browser is waiting for the entire file before it's displayed(using php)? I don't think the average user will have the patience to stare at a blank browser waiting for the file. This is a pdf issue I believe. There is an option in the PDF called 'Fast Web View', if this is set adobe doesn't need to read the whole thing before starting to view. Check the pdf's 'Document properties' and You'll see if the option is set or not. If not, resave the document enabling that option. Acrobat 5 has a nice little batch thing to convert serveral docuements into this mode. HTH, Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finally, PDF Header for PDF stuffs that work....
Curt Zirzow wrote: * Thus wrote John Herren ([EMAIL PROTECTED]): header(Content-Type: application/pdf); header(Accept-Ranges: bytes); header(Content-Length: .filesize($thefile)); readfile($thefile); Can anybody tell me why the browser is waiting for the entire file before it's displayed(using php)? I don't think the average user will have the patience to stare at a blank browser waiting for the file. This is a pdf issue I believe. There is an option in the PDF called 'Fast Web View', if this is set adobe doesn't need to read the whole thing before starting to view. Check the pdf's 'Document properties' and You'll see if the option is set or not. If not, resave the document enabling that option. Acrobat 5 has a nice little batch thing to convert serveral docuements into this mode. HTH, Curt I appreciate that advice. And Fast Web View is disabled. But I still don't understand why calling the file directly gives immediate output, but if I generate the headers and readfile() the file to the browser (same exact file) it waits to get the whole file. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finally, PDF Header for PDF stuffs that work....
* Thus wrote John Herren ([EMAIL PROTECTED]): If I call a pdf file directly, the Acrobat plugin begins to display the file almost immediately. Here is the reponse header for calling the file directly: Last-Modified: Thu, 16 Oct 2003 17:08:17 GMT ETag: 94174-341fcb-3f8ed081 Content-Length: 3416011 I forgot to also mention this: I'd put a high wager that the pdf has been cached and is being loaded from the cache instead. I wrote a pdf-serving script for anti-leech purposes, and it works fine, except that the acrobat plugin waits for the entire file to come down the pipe before anything is displayed. The mystery for me is that the headers--the important ones anyway--look exactly the same. Dig: HTTP/1.1 200 OK Date: Thu, 16 Oct 2003 20:44:45 GMT Server: Apache/1.3.27 (Unix) (Red-Hat/Linux) mod_ssl/2.8.12 OpenSSL/0.9.6b PHP/4.3.3 mod_perl/1.26 X-Meta-MSSmartTagsPreventParsing: TRUE X-MSSmartTagsPreventParsing: TRUE X-Powered-By: PHP/4.3.3 X-Accelerated-By: PHPA/1.3.3r2 Accept-Ranges: bytes Content-Length: 3416011 Connection: close Content-Type: application/pdf Notice no Etag, last-modified. There is no way IE or any browser can cache this document, it is going to request it all the time. Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finally, PDF Header for PDF stuffs that work....
* Thus wrote Scott Fletcher ([EMAIL PROTECTED]): //Can't use readfile() due to poor controlling of the file download. //(IE have this problems)... //readfile($filepath); readfile has no effect on how IE handles downloads. //use fopen() instead of readfile... $fp = fopen($filepath, 'rb'); $pdf_buffer = fread($fp, $filesize); fclose ($fp); print $pdf_buffer; Loading the whole file in memory and not doing anything with it before sending it to the client doesn't make much sense. //Required, to keep IE from running into problems //when opening the file while downloading or downloading... //(IE been acting strange...) exit(); This also doesn't effect IE. Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finally, PDF Header for PDF stuffs that work....
On Tue, 2003-10-14 at 17:33, Curt Zirzow wrote: //use fopen() instead of readfile... $fp = fopen($filepath, 'rb'); $pdf_buffer = fread($fp, $filesize); fclose ($fp); print $pdf_buffer; Loading the whole file in memory and not doing anything with it before sending it to the client doesn't make much sense. Are you saying readfile() somehow avoids loading the whole file into memory? maybe it does, you learn everyday, I am just wondering... Mohamed~ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finally, PDF Header for PDF stuffs that work....
* Thus wrote Mohamed Lrhazi ([EMAIL PROTECTED]): On Tue, 2003-10-14 at 17:33, Curt Zirzow wrote: //use fopen() instead of readfile... $fp = fopen($filepath, 'rb'); $pdf_buffer = fread($fp, $filesize); fclose ($fp); print $pdf_buffer; Loading the whole file in memory and not doing anything with it before sending it to the client doesn't make much sense. Are you saying readfile() somehow avoids loading the whole file into memory? maybe it does, you learn everyday, I am just wondering... Correct, readfile() doesn't load the whole file into memory. Imagine if readfile did read the whole thing into memory. and you have a script was sending 100MB files to the users and then 10 people happend to come across your site at the same time. your system will require, at minimum, 1000MB's of memory to send the files. And cross your fingers the site doesn't get posted to a BBs. Curt -- My PHP key is worn out PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php