|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-16 23:04 UTC] mike at phpeeb dot com
[2005-03-17 08:25 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 13 21:00:01 2025 UTC |
Description: ------------ This bug has been mentioned before, but not with my operating system, as far as I can tell. The PDF_open_file() function is documented at only requiring the resource, and not the second argument. Howerver, I get this error: pdf_open_file() expects exactly 2 parameters, 1 given .... When I use a second argument, It gives this error: pdf_get_buffer(): [1052] PDF_get_buffer: Don't fetch buffer contents when writing to file in... When the two lines relating to the buffer are commented out, I get no more errors, yet the output PDF file is corrupt. When using inline disposition, a blank page is the result, when attachment is used, Adobe Reader launches, yet it reurns an error saying the document is corrupt. The code used was from an example, that apparently works for countless people, so I know it's not the code itself that is bad. Reproduce code: --------------- $pdf = pdf_new(); pdf_open_file($pdf, 'e'); pdf_begin_page($pdf, (72 * 8.5), (72 * 11)); $font = pdf_findfont($pdf, "Times-Roman", "host", 0); // Some code snipped // pdf_show($pdf, "Testing PDF Document Creation"); pdf_end_page($pdf); pdf_close($pdf); // The following line produces error when not commented out // $length = strlen(pdf_get_buffer($pdf)); header("Content-Type: application/pdf"); header("Content-Length: ".$length); header("Content-Disposition: attachment; filename=test.pdf); pdf_delete($pdf); Expected result: ---------------- A PDF file that simply reads "Testing PDF Document Creation". Actual result: -------------- Blank page or corrupt PDF depending on content disposition