NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
PDF usage icw php5


Joined: 27 May 2009
Posts: 2
Reply with quote
For php4 I have no problem with setting up pdf support but for php5 I encounter a problem:

I've enabled the php extension in the php.ini file in the php5 directory by adding this line:

extension=php_pdflib.dll

But I encounter a problem when I try to execute the pdf demo script (copied from php.net):

<?php

try {
$p = new PDFlib();

/* open new PDF file; insert a file name to create the PDF on disk */
if ($p->begin_document("c:\\temp\\test5.pdf", "") == 0) {
die("Error: " . $p->get_errmsg());
}

$p->set_info("Creator", "hello.php");
$p->set_info("Author", "Rainer Schaaf");
$p->set_info("Title", "Hello world (PHP)!");

$p->begin_page_ext(595, 842, "");

$font = $p->load_font("Helvetica-Bold", "winansi", "");

$p->setfont($font, 24.0);
$p->set_text_pos(50, 700);
$p->show("Hello world!");
$p->continue_text("(says PHP)");
$p->end_page_ext("");

$p->end_document("");

$buf = $p->get_buffer();
$len = strlen($buf);

header("Content-type: application/pdf");
header("Content-Length: $len");
header("Content-Disposition: inline; filename=hello.pdf");
print $buf;
}
catch (PDFlibException $e) {
die("PDFlib exception occurred in hello sample:\n" .
"[" . $e->get_errnum() . "] " . $e->get_apiname() . ": " .
$e->get_errmsg() . "\n");
}
catch (Exception $e) {
die($e);
}
$p = 0;

?>

I get following error:
Internal server error. Failed to read fastcgi header

What am I doing wrong or what did I forget to configure?

Help or suggestions are appreciated!!!

regards,
Rob
View user's profileFind all posts by RoboRobSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
As far as I remember, php_pdflib.dll is not stable.
Perhaps, it crashed in your case.
I tried to run your code with php-cgi.exe and got
PDFlib exception (fatal): [1202] PDF_set_parameter: Unknown key 'objorient'
If you you cant resolve this problem, please contact php-general news group and as for help with pdflib.

Otherwise I'd recommend you to find pdf classes written in pure PHP. They work much better Smile

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
PDF usage icw php5
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic