|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
||||
|
||||
|
Install PDFLib and use PDF function
I am trying to use the PDF functions with PHP-5 on a windows environment. I downloaded the PDFLib lite 7.0.2 but I can not find anywhere how to get it to work. I get the following error:
------------- PHP Fatal error: Class 'PDFlib' not found in C:\Inetpub\wwwroot\PDF.php on line 4 ------------- The PHP documentation does not provide much help either. I appreciate any help or any pointer on this subject. Thanks Last edited by popeye : August 16th, 2007 at 11:07 AM. |
|
#2
|
||||
|
||||
|
Download the PECL Win binary that matches your PHP version from php.net - http://www.php.net/downloads.php
Unzip the files. Copy the php_pdf.dll file into your php extensions folder. Add the following line to your php.ini - extension=php_pdf.dll Stop and start your web server to get the change made to php.ini to take effect. Since you appear to be using IIS, the easiest way to accomplish this step is to reboot your computer. |
|
#3
|
||||
|
||||
|
I did what you suggested and it looked like it worked for a while but then when I tried to run the following sample script from PHP5 documentation:
========================================== Example 2. Hello World example from PDFlib distribution for PHP 5 Code:
<?php
try {
$p = new PDFlib();
/* open new PDF file; insert a file name to create the PDF on disk */
if ($p->begin_document("", "") == 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 got the following error. ----------------------------------------------------- CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: PDFlib exception (fatal): [1202] PDF_set_parameter: Unknown key 'objorient' Error in my_thread_global_end(): 1 threads didn't exit ----------------------------------------------------- or ----------------------------------------------------- PHP Fatal error: Call to undefined function PDF_begin_document() in C:\Inetpub\wwwroot\JHHLS\PDF.php on line 5 ----------------------------------------------------- I appriciate any comments. Thanks Last edited by popeye : August 16th, 2007 at 03:25 PM. |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Installation > Install PDFLib and use PDF function |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|