Re: [PHP4BETA] pdf causes three requests?
| From: | Johan Näsholm | Date: | Wed, 10 May 2000 23:04:19 +0000 |
| Subject: | Re: [PHP4BETA] pdf causes three requests? | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-14802@lists.php.net to get a copy of this message | ||
Hi,
I have noticed that some browsers send several requests for parts of the
file requested. Check the size of the PDF and compare it to the sum of the
three requests. The response code for the requests should be 206 (Partial
Content).
Johan
> Using PHP4RC1 and PDF3, the following code causes two problems.
>
> First, it does not display the pdf file, but the pdf file is there and if I
> use it's direct URL, it displays. Seems to only fail on smaller output
> files.
>
> Second, the access log show three accesses to the script, and it does go
> through the script three times. Why?
>
> <?php
> $fp = fopen("test.pdf", "w");
> $pdf = PDF_open($fp);
>
> PDF_set_parameter($pdf,"resourcefile","/usr/local/apache/htdocs/pdflib.upr")
> ;
> PDF_begin_page($pdf, 595, 842);
> pdf_set_font($pdf, "Times-Roman", 24, "winansi");
> pdf_set_text_rendering($pdf, 0);
> PDF_set_text_pos($pdf, 50, 750);
> PDF_show($pdf, "Hello World");
> PDF_end_page($pdf);
> PDF_close($pdf);
> fclose($fp);
>
> $fp2 = fopen("test.pdf", "r");
> header("Content-type: application/pdf");
> fpassthru($fp2);
> fclose($fp2);
> ?>
>
>
>
> ---
> www.KeithFord.com ICQ-15705088 Visit www.PalmFoolery.com today!
> day-800.500.8381 cell-256.603.3932
> fax-419.858.8833 info-256.971.9711
>