10.07.2015 Views

Download - Multivac!

Download - Multivac!

Download - Multivac!

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.8 PHP BindingInstalling the PDFlib PHP Edition. Detailed information about the various flavors andoptions for using PDFlib with PHP 1 , including the question of whether or not to use aloadable PDFlib module for PHP, can be found in the PDFlib-in-PHP-HowTo.pdf documentwhich is contained in the distribution packages and also available on the PDFlib Website.You must configure PHP so that it knows about the external PDFlib library. You havetwo choices:> Add one of the following lines in php.ini:extension=libpdf_php.soextension=libpdf_php.dll; for Unix; for WindowsPHP will search the library in the directory specified in the extension_dir variable inphp.ini on Unix, and additionally in the standard system directories on Windows.You can test which version of the PHP PDFlib binding you have installed with the followingone-line PHP script:This will display a long info page about your current PHP configuration. On this pagecheck the section titled pdf. If this section contains PDFlib GmbH Binary Version (andthe PDFlib version number) you are using the supported new PDFlib wrapper. Theunsupported old wrapper will display PDFlib GmbH Version instead.> Load PDFlib at runtime with one of the following lines at the start of your script:dl("libpdf_php.so");dl("libpdf_php.dll");# for Unix# for WindowsPHP 5 features. PDFlib takes advantage of the following new features in PHP 5:> New object model: the PDFlib functions are encapsulated within a PDFlib object.> Exceptions: PDFlib exceptions will be propagated as PHP 5 exceptions, and can becaught with the usual try/catch technique. New-style exception handling can beused with both the new object-oriented approach and the old API functions.See below for more details on these PHP 5 features.Modified error return for PDFlib functions in PHP. Since PHP uses the convention of returningthe value 0 (FALSE) when an error occurs within a function, all PDFlib functionshave been adjusted to return 0 instead of -1 in case of an error. This difference is notedin the function descriptions in the PDFlib Reference. However, take care when readingthe code fragment examples in Section 3, »PDFlib Programming«, page 45, since theseuse the usual PDFlib convention of returning -1 in case of an error.File name handling in PHP. Unqualified file names (without any path component) andrelative file names for PDF, image, font and other disk files are handled differently inUnix and Windows versions of PHP:> PHP on Unix systems will find files without any path component in the directorywhere the script is located.1. See www.php.net2.8 PHP Binding 37

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!