diff --git a/reference/pdf/book.xml b/reference/pdf/book.xml new file mode 100644 index 0000000000..c792d5859b --- /dev/null +++ b/reference/pdf/book.xml @@ -0,0 +1,117 @@ + + + + + + + PDF + + + + &reftitle.intro; + + The PDF functions in PHP can create PDF files using the PDFlib + library which was initially created by Thomas Merz and is now + maintained by PDFlib GmbH. + + + The documentation in this section is only meant to be an overview + of the available functions in the PDFlib library and should not be + considered an exhaustive reference. For the full and detailed + explanation of each function, consult the PDFlib Reference Manual + which is included in all PDFlib packages distributed by PDFlib GmbH. + It provides a very good overview of what PDFlib is capable of doing + and contains the most up-to-date documentation of all functions. + + + For a jump start we urge you to take a look at the programming samples + which are contained in all PDFlib distribution packages. These samples + demonstrate basic text, vector, and graphics output as well as + higher-level functions, such as the PDF import facility (PDI). + + + All of the functions in PDFlib and the PHP module have identical + function names and parameters. Unless configured otherwise, all + lengths and coordinates are measured in PostScript points. There are + generally 72 PostScript points to an inch, but this depends on the + output resolution. Please see the PDFlib Reference Manual + included in the PDFlib distribution for a more thorough explanation + of the coordinate system used. + + + With version 6, PDFlib offers an object-oriented API for PHP 5 in + addition to the function-oriented API for PHP 4. The main difference is + the following: + + + In PHP 4, first a PDF resource has to be retrieved with a function call + like + + + $p = PDF_new(). + + + This PDF resource is used as the first parameter in all further function + calls, such as in + + + PDF_begin_document($p, "", ""). + + + In PHP 5 however, a PDFlib object is created with + + + $p = new PDFlib(). + + + This object offers all PDFlib API functions as methods, e.g. as with + + + $p->begin_document("", ""). + + + In addition, exceptions have been introduced in PHP 5 which are + supported by PDFlib 6 and later as well. + + + Please see the examples below for + more information. + + + + If you're interested in alternative free PDF generators that do not + utilize external PDF libraries, see + this related FAQ. + + + + + + &reference.pdf.setup; + &reference.pdf.constants; + &reference.pdf.examples; + &reference.pdf.reference; + + + + + diff --git a/reference/pdf/constants.xml b/reference/pdf/constants.xml new file mode 100644 index 0000000000..a7e1f970a9 --- /dev/null +++ b/reference/pdf/constants.xml @@ -0,0 +1,29 @@ + + + + + &reftitle.constants; + &no.constants; + + + + diff --git a/reference/pdf/examples.xml b/reference/pdf/examples.xml new file mode 100644 index 0000000000..f0980c567e --- /dev/null +++ b/reference/pdf/examples.xml @@ -0,0 +1,121 @@ + + + + +&reftitle.examples; +
+ Basic Usage Examples + + Most of the functions are fairly easy to use. The most difficult part + is probably creating your first PDF document. The following + example should help to get you started. It is developed for PHP 4 and + creates the file hello.pdf with one page. + It defines some document info field contents, loads the Helvetica-Bold + font and outputs the text "Hello world! (says PHP)". + + + + Hello World example from PDFlib distribution for PHP 4 + + +]]> + + + + + + The following example comes with the PDFlib distribution for PHP 5. + It uses the new exception handling and object encapsulation features + available in PHP 5. It creates the file hello.pdf + with one page. It defines some document info field contents, loads the + Helvetica-Bold font and outputs the text "Hello world! (says PHP)". + + + + Hello World example from PDFlib distribution for PHP 5 + +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; +?> +]]> + + + +
+
diff --git a/reference/pdf/reference.xml b/reference/pdf/reference.xml index 08e920d413..5b2babb896 100644 --- a/reference/pdf/reference.xml +++ b/reference/pdf/reference.xml @@ -1,126 +1,10 @@ - - - + PDF &Functions; - PDF - -
- &reftitle.intro; - - The PDF functions in PHP can create PDF files using the PDFlib - library which was initially created by Thomas Merz and is now - maintained by PDFlib GmbH. - - - The documentation in this section is only meant to be an overview - of the available functions in the PDFlib library and should not be - considered an exhaustive reference. For the full and detailed - explanation of each function, consult the PDFlib Reference Manual - which is included in all PDFlib packages distributed by PDFlib GmbH. - It provides a very good overview of what PDFlib is capable of doing - and contains the most up-to-date documentation of all functions. - - - For a jump start we urge you to take a look at the programming samples - which are contained in all PDFlib distribution packages. These samples - demonstrate basic text, vector, and graphics output as well as - higher-level functions, such as the PDF import facility (PDI). - - - All of the functions in PDFlib and the PHP module have identical - function names and parameters. Unless configured otherwise, all - lengths and coordinates are measured in PostScript points. There are - generally 72 PostScript points to an inch, but this depends on the - output resolution. Please see the PDFlib Reference Manual - included in the PDFlib distribution for a more thorough explanation - of the coordinate system used. - - - With version 6, PDFlib offers an object-oriented API for PHP 5 in - addition to the function-oriented API for PHP 4. The main difference is - the following: - - - In PHP 4, first a PDF resource has to be retrieved with a function call - like - - - $p = PDF_new(). - - - This PDF resource is used as the first parameter in all further function - calls, such as in - - - PDF_begin_document($p, "", ""). - - - In PHP 5 however, a PDFlib object is created with - - - $p = new PDFlib(). - - - This object offers all PDFlib API functions as methods, e.g. as with - - - $p->begin_document("", ""). - - - In addition, exceptions have been introduced in PHP 5 which are - supported by PDFlib 6 and later as well. - - - Please see the examples below for - more information. - - - - If you're interested in alternative free PDF generators that do not - utilize external PDF libraries, see - this related FAQ. - - -
- -
- &reftitle.required; - - PDFlib Lite is available as open source. However, the - PDFlib Lite license allows free use only under certain conditions. - PDFlib Lite supports a subset of PDFlib's functionality; please see the - PDFlib web site for details. The full version of PDFlib is available for - download at &url.pdf;, but requires that - you purchase a license for commercial use. - -
- -
- Issues with older versions of PDFlib - - Any version of PHP 4 after March 9, 2000 does not support versions - of PDFlib older than 3.0. - - - PDFlib 4.0 or greater is supported by PHP 4.3.0 and later. - -
- - &reference.pdf.configure; - -
- &reftitle.resources; - - PDF_new creates a new PDFlib object required by most - PDF functions. - -
- -
+ Remarks about Deprecated PDFlib Functions Starting with PHP 4.0.5, the PHP extension for PDFlib is @@ -135,123 +19,6 @@ functions. The documentation in this section indicates old functions as "Deprecated" and gives the replacement function to be used instead. -
- -
- &reftitle.examples; - - Most of the functions are fairly easy to use. The most difficult part - is probably creating your first PDF document. The following - example should help to get you started. It is developed for PHP 4 and - creates the file hello.pdf with one page. - It defines some document info field contents, loads the Helvetica-Bold - font and outputs the text "Hello world! (says PHP)". - - - - Hello World example from PDFlib distribution for PHP 4 - - -]]> - - - - - - The following example comes with the PDFlib distribution for PHP 5. - It uses the new exception handling and object encapsulation features - available in PHP 5. It creates the file hello.pdf - with one page. It defines some document info field contents, loads the - Helvetica-Bold font and outputs the text "Hello world! (says PHP)". - - - - Hello World example from PDFlib distribution for PHP 5 - -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; -?> -]]> - - - -
&reference.pdf.entities.functions; diff --git a/reference/pdf/setup.xml b/reference/pdf/setup.xml new file mode 100644 index 0000000000..93f88ad10c --- /dev/null +++ b/reference/pdf/setup.xml @@ -0,0 +1,74 @@ + + + + + &reftitle.setup; + + +
+ &reftitle.required; + + PDFlib Lite is available as open source. However, the + PDFlib Lite license allows free use only under certain conditions. + PDFlib Lite supports a subset of PDFlib's functionality; please see the + PDFlib web site for details. The full version of PDFlib is available for + download at &url.pdf;, but requires that + you purchase a license for commercial use. + +
+ Issues with older versions of PDFlib + + Any version of PHP 4 after March 9, 2000 does not support versions + of PDFlib older than 3.0. + + + PDFlib 4.0 or greater is supported by PHP 4.3.0 and later. + +
+
+ + + + &reference.pdf.configure; + + + +
+ &reftitle.runtime; + &no.config; +
+ + + +
+ &reftitle.resources; + + PDF_new creates a new PDFlib object required by most + PDF functions. + +
+ + +
+ + +