#32344 [NEW]: pdf_open_file() expects exactly 2 parameters, among others

From: Date: Wed, 16 Mar 2005 22:02:28 +0000
Subject: #32344 [NEW]: pdf_open_file() expects exactly 2 parameters, among others
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-75400@lists.php.net to get a copy of this message
From: mike at phpeeb dot com Operating system: Windows XP Pro (SP1) PHP version: 4.3.9 PHP Bug Type: PDF related Bug description: pdf_open_file() expects exactly 2 parameters, among others 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 -- Edit bug report at http://bugs.php.net/?id=32344&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32344&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32344&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32344&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32344&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32344&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32344&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32344&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32344&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32344&r=support Expected behavior: http://bugs.php.net/fix.php?id=32344&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32344&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32344&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32344&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32344&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32344&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32344&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32344&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32344&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32344&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32344&r=mysqlcfg

« previous php.bugs (#75400) next »