cvs: phpdoc /en/reference/cpdf book.xml constants.xml examples.xml reference.xml setup.xml
| From: | Hannes Magnusson | Date: | Thu, 13 Dec 2007 20:00:05 +0000 |
| Subject: | cvs: phpdoc /en/reference/cpdf book.xml constants.xml examples.xml reference.xml setup.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-631@lists.php.net to get a copy of this message | ||
bjori Thu Dec 13 20:00:05 2007 UTC
Modified files:
/phpdoc/en/reference/cpdf book.xml examples.xml setup.xml
constants.xml reference.xml
Log:
MFB: Upgrade to the new-reference-structure
- Moved the intro from reference.xml to book.xml
- Change the intro ID to intro.<extname>
- Moved from reference.xml
- To setup.xml
- The requirements section
- The installation entity
- The configuration section
- (Added resources section)
- To examples.xml (<chapter>
- The cpdf.examples section
- Changed the constants section to be an <appendix>
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/book.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/cpdf/book.xml diff -u /dev/null phpdoc/en/reference/cpdf/book.xml:1.2 --- /dev/null Thu Dec 13 20:00:04 2007 +++ phpdoc/en/reference/cpdf/book.xml Thu Dec 13 20:00:04 2007 @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.2 $ --> +<!-- Purpose: utilspec.nontext --> +<!-- Membership: pecl, external --> +<!-- State: deprecated --> + +<book xml:id="book.cpdf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>ClibPDF</title> + + <!-- {{{ preface --> + <preface xml:id="intro.cpdf"> + &reftitle.intro; + <warning> + <para> + ClibPDF support is deprecated and users are strongly encouraged to use + an alternative, like <link linkend="book.haru">Haru</link>, + <link linkend="book.pdf">PDFlib</link>, or one of the available + <link linkend="faq.using.freepdf">PHP alternatives.</link> + </para> + </warning> + <para> + ClibPDF lets you create PDF documents with PHP. ClibPDF functionality + and API are similar to <link linkend="book.pdf">PDFlib</link>. + This documentation should be read alongside the ClibPDF manual since it + explains the library in much greater detail. + </para> + <para> + Many functions in the native ClibPDF and the PHP module, as well + as in <link linkend="book.pdf">PDFlib</link>, have the same name. + All functions except for <function>cpdf_open</function> take the + handle for the document as their first parameter. + </para> + <para> + Currently this handle is not used internally since ClibPDF does + not support the creation of several PDF documents at the same time. + Actually, you should not even try it, the results are unpredictable. I + can't oversee what the consequences in a multi threaded environment + are. According to the author of ClibPDF this will change in one of + the next releases (current version when this was written is 1.10). + If you need this functionality use the pdflib module. + </para> + <para> + A nice feature of ClibPDF (and <link + linkend="book.pdf">PDFlib</link>) is the ability to create the pdf + document completely in memory without using temporary files. It + also provides the ability to pass coordinates in a predefined unit + length. (This feature can also be simulated by + <function>pdf_translate</function> when using the <link + linkend="book.pdf">PDFlib</link> functions.) + </para> + <para> + Another nice feature of ClibPDF is the fact that any page can be modified + at any time even if a new page has been already opened. The function + <function>cpdf_set_current_page</function> allows to leave the current + page and presume modifying an other page. + </para> + <para> + Most of the functions are fairly easy to use. The most difficult part + is probably creating a very simple PDF document at all. The following + example should help you to get started. It creates a document + with one page. The page contains the text "Times-Roman" in an + outlined 30pt font. The text is underlined. + </para> + <note> + <para> + &pecl.moved-ver;5.1.0. + </para> + </note> + <note> + <simpara> + If you're interested in alternative free PDF generators that do not + utilize external PDF libraries, see <link linkend="faq.using.freepdf"> + this related FAQ</link>. + </simpara> + </note> + </preface> + <!-- }}} --> + + &reference.cpdf.setup; + &reference.cpdf.constants; + &reference.cpdf.examples; + &reference.cpdf.reference; + +</book> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/examples.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/cpdf/examples.xml diff -u /dev/null phpdoc/en/reference/cpdf/examples.xml:1.2 --- /dev/null Thu Dec 13 20:00:04 2007 +++ phpdoc/en/reference/cpdf/examples.xml Thu Dec 13 20:00:04 2007 @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- $Revision: 1.2 $ --> + +<chapter xml:id="cpdf.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + &reftitle.examples; + <example> + <title>Simple ClibPDF Example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$cpdf = cpdf_open(0); +cpdf_page_init($cpdf, 1, 0, 595, 842, 1.0); +cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1"); +cpdf_begin_text($cpdf); +cpdf_set_font($cpdf, "Times-Roman", 30, "WinAnsiEncoding"); +cpdf_set_text_rendering($cpdf, 1); +cpdf_text($cpdf, "Times Roman outlined", 50, 50); +cpdf_end_text($cpdf); +cpdf_moveto($cpdf, 50, 50); +cpdf_lineto($cpdf, 740, 330); +cpdf_stroke($cpdf); +cpdf_finalize_page($cpdf, 1); +cpdf_finalize($cpdf); +Header("Content-type: application/pdf"); +cpdf_output_buffer($cpdf); +cpdf_close($cpdf); +?> +]]> + </programlisting> + </example> + <para> + The pdflib distribution contains a more complex example which creates a + series of pages with an analog clock. Here is that example converted + into PHP using the ClibPDF extension: + </para> + <example> + <title>pdfclock example from pdflib 2.0 distribution</title> + <programlisting role="php"> +<![CDATA[ +<?php +$radius = 200; +$margin = 20; +$pagecount = 40; + +$pdf = cpdf_open(0); +cpdf_set_creator($pdf, "pdf_clock.php"); +cpdf_set_title($pdf, "Analog Clock"); + +while ($pagecount-- > 0) { + cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0); + + cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0); /* wipe */ + + cpdf_translate($pdf, $radius + $margin, $radius + $margin); + cpdf_save($pdf); + cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0); + + /* minute strokes */ + cpdf_setlinewidth($pdf, 2.0); + for ($alpha = 0; $alpha < 360; $alpha += 6) { + cpdf_rotate($pdf, 6.0); + cpdf_moveto($pdf, $radius, 0.0); + cpdf_lineto($pdf, $radius-$margin/3, 0.0); + cpdf_stroke($pdf); + } + + cpdf_restore($pdf); + cpdf_save($pdf); + + /* 5 minute strokes */ + cpdf_setlinewidth($pdf, 3.0); + for ($alpha = 0; $alpha < 360; $alpha += 30) { + cpdf_rotate($pdf, 30.0); + cpdf_moveto($pdf, $radius, 0.0); + cpdf_lineto($pdf, $radius-$margin, 0.0); + cpdf_stroke($pdf); + } + + $ltime = getdate(); + + /* draw hour hand */ + cpdf_save($pdf); + cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0); + cpdf_moveto($pdf, -$radius/10, -$radius/20); + cpdf_lineto($pdf, $radius/2, 0.0); + cpdf_lineto($pdf, -$radius/10, $radius/20); + cpdf_closepath($pdf); + cpdf_fill($pdf); + cpdf_restore($pdf); + + /* draw minute hand */ + cpdf_save($pdf); + cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0); + cpdf_moveto($pdf, -$radius/10, -$radius/20); + cpdf_lineto($pdf, $radius * 0.8, 0.0); + cpdf_lineto($pdf, -$radius/10, $radius/20); + cpdf_closepath($pdf); + cpdf_fill($pdf); + cpdf_restore($pdf); + + /* draw second hand */ + cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0); + cpdf_setlinewidth($pdf, 2); + cpdf_save($pdf); + cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0)); + cpdf_moveto($pdf, -$radius/5, 0.0); + cpdf_lineto($pdf, $radius, 0.0); + cpdf_stroke($pdf); + cpdf_restore($pdf); + + /* draw little circle at center */ + cpdf_circle($pdf, 0, 0, $radius/30); + cpdf_fill($pdf); + + cpdf_restore($pdf); + + cpdf_finalize_page($pdf, $pagecount+1); +} + +cpdf_finalize($pdf); +Header("Content-type: application/pdf"); +cpdf_output_buffer($pdf); +cpdf_close($pdf); +?> +]]> + </programlisting> + </example> +</chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/setup.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/cpdf/setup.xml diff -u /dev/null phpdoc/en/reference/cpdf/setup.xml:1.2 --- /dev/null Thu Dec 13 20:00:04 2007 +++ phpdoc/en/reference/cpdf/setup.xml Thu Dec 13 20:00:04 2007 @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.2 $ --> + +<chapter xml:id="cpdf.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + &reftitle.setup; + + <!-- {{{ Requirements --> + <section xml:id="cpdf.requirements"> + &reftitle.required; + <para> + In order to use the ClibPDF functions you need to install the ClibPDF + package. It is available for download from <link xlink:href="&url.fastio;"> + FastIO</link>, but requires that you purchase a license for commercial + use. PHP requires that you use cpdflib >= 2. + The development of ClibPDF library has been discontinued thus FastIO + website would be most probably inaccessible. + </para> + </section> + <!-- }}} --> + + <!-- {{{ Installation --> + &reference.cpdf.configure; + <!-- }}} --> + + <!-- {{{ Configuration --> + <section xml:id="cpdf.configuration"> + &reftitle.runtime; + &no.config; + </section> + <!-- }}} --> + + <!-- {{{ Resources --> + <section xml:id="cpdf.resources"> + &reftitle.resources; + &no.resource; + </section> + <!-- }}} --> + +</chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/constants.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/cpdf/constants.xml diff -u phpdoc/en/reference/cpdf/constants.xml:1.3 phpdoc/en/reference/cpdf/constants.xml:1.4 --- phpdoc/en/reference/cpdf/constants.xml:1.3 Wed Jun 20 22:24:17 2007 +++ phpdoc/en/reference/cpdf/constants.xml Thu Dec 13 20:00:04 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> -<section xml:id="cpdf.constants" xmlns="http://docbook.org/ns/docbook"> +<!-- $Revision: 1.4 $ --> +<appendix xml:id="cpdf.constants" xmlns="http://docbook.org/ns/docbook"> &reftitle.constants; &extension.constants; <variablelist> @@ -93,7 +93,7 @@ </listitem> </varlistentry> </variablelist> -</section> +</appendix> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/reference.xml?r1=1.19&r2=1.20&diff_format=u Index: phpdoc/en/reference/cpdf/reference.xml diff -u phpdoc/en/reference/cpdf/reference.xml:1.19 phpdoc/en/reference/cpdf/reference.xml:1.20 --- phpdoc/en/reference/cpdf/reference.xml:1.19 Mon Dec 10 17:06:01 2007 +++ phpdoc/en/reference/cpdf/reference.xml Thu Dec 13 20:00:04 2007 @@ -1,240 +1,20 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.19 $ --> -<!-- Purpose: utilspec.nontext --> -<!-- Membership: pecl, external --> -<!-- State: deprecated --> +<!-- $Revision: 1.20 $ --> - <reference xml:id="ref.cpdf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> - <title>ClibPDF Functions [deprecated]</title> - <titleabbrev>ClibPDF</titleabbrev> +<reference xml:id="ref.cpdf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>ClibPDF &Functions; [deprecated]</title> - <partintro> - <section xml:id="cpdf.intro"> - &reftitle.intro; - <warning> - <para> - ClibPDF support is deprecated and users are strongly encouraged to use - an alternative, like <link linkend="ref.haru">Haru</link>, - <link linkend="ref.pdf">PDFlib</link>, or one of the available - <link linkend="faq.using.freepdf">PHP alternatives.</link> - </para> - </warning> - <para> - ClibPDF lets you create PDF documents with PHP. ClibPDF functionality - and API are similar to <link linkend="ref.pdf">PDFlib</link>. - This documentation should be read alongside the ClibPDF manual since it - explains the library in much greater detail. - </para> - <para> - Many functions in the native ClibPDF and the PHP module, as well - as in <link linkend="ref.pdf">PDFlib</link>, have the same name. - All functions except for <function>cpdf_open</function> take the - handle for the document as their first parameter. - </para> - <para> - Currently this handle is not used internally since ClibPDF does - not support the creation of several PDF documents at the same time. - Actually, you should not even try it, the results are unpredictable. I - can't oversee what the consequences in a multi threaded environment - are. According to the author of ClibPDF this will change in one of - the next releases (current version when this was written is 1.10). - If you need this functionality use the pdflib module. - </para> - <para> - A nice feature of ClibPDF (and <link - linkend="ref.pdf">PDFlib</link>) is the ability to create the pdf - document completely in memory without using temporary files. It - also provides the ability to pass coordinates in a predefined unit - length. (This feature can also be simulated by - <function>pdf_translate</function> when using the <link - linkend="ref.pdf">PDFlib</link> functions.) - </para> - <para> - Another nice feature of ClibPDF is the fact that any page can be modified - at any time even if a new page has been already opened. The function - <function>cpdf_set_current_page</function> allows to leave the current - page and presume modifying an other page. - </para> - <para> - Most of the functions are fairly easy to use. The most difficult part - is probably creating a very simple PDF document at all. The following - example should help you to get started. It creates a document - with one page. The page contains the text "Times-Roman" in an - outlined 30pt font. The text is underlined. - </para> - <note> - <para> - &pecl.moved-ver;5.1.0. - </para> - </note> - <note> - <simpara> - If you're interested in alternative free PDF generators that do not - utilize external PDF libraries, see <link linkend="faq.using.freepdf"> - this related FAQ</link>. - </simpara> - </note> - </section> - - <section xml:id="cpdf.requirements"> - &reftitle.required; - <para> - In order to use the ClibPDF functions you need to install the ClibPDF - package. It is available for download from <link xlink:href="&url.fastio;"> - FastIO</link>, but requires that you purchase a license for commercial - use. PHP requires that you use cpdflib >= 2. - The development of ClibPDF library has been discontinued thus FastIO - website would be most probably inaccessible. - </para> - </section> + <partintro xml:id="cpdf.seealso"> + &reftitle.seealso; + <para> + See also the <link linkend="ref.pdf">PDFlib</link> + extension documentation. + </para> + </partintro> - &reference.cpdf.configure; + &reference.cpdf.entities.functions; - <section xml:id="cpdf.configuration"> - &reftitle.runtime; - &no.config; - </section> - - &reference.cpdf.constants; - - <section xml:id="cpdf.examples"> - &reftitle.examples; - <example> - <title>Simple ClibPDF Example</title> - <programlisting role="php"> -<![CDATA[ -<?php -$cpdf = cpdf_open(0); -cpdf_page_init($cpdf, 1, 0, 595, 842, 1.0); -cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1"); -cpdf_begin_text($cpdf); -cpdf_set_font($cpdf, "Times-Roman", 30, "WinAnsiEncoding"); -cpdf_set_text_rendering($cpdf, 1); -cpdf_text($cpdf, "Times Roman outlined", 50, 50); -cpdf_end_text($cpdf); -cpdf_moveto($cpdf, 50, 50); -cpdf_lineto($cpdf, 740, 330); -cpdf_stroke($cpdf); -cpdf_finalize_page($cpdf, 1); -cpdf_finalize($cpdf); -Header("Content-type: application/pdf"); -cpdf_output_buffer($cpdf); -cpdf_close($cpdf); -?> -]]> - </programlisting> - </example> - <para> - The pdflib distribution contains a more complex example which creates a - series of pages with an analog clock. Here is that example converted - into PHP using the ClibPDF extension: - </para> - <example> - <title>pdfclock example from pdflib 2.0 distribution</title> - <programlisting role="php"> -<![CDATA[ -<?php -$radius = 200; -$margin = 20; -$pagecount = 40; - -$pdf = cpdf_open(0); -cpdf_set_creator($pdf, "pdf_clock.php"); -cpdf_set_title($pdf, "Analog Clock"); - -while ($pagecount-- > 0) { - cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0); - - cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0); /* wipe */ - - cpdf_translate($pdf, $radius + $margin, $radius + $margin); - cpdf_save($pdf); - cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0); - - /* minute strokes */ - cpdf_setlinewidth($pdf, 2.0); - for ($alpha = 0; $alpha < 360; $alpha += 6) { - cpdf_rotate($pdf, 6.0); - cpdf_moveto($pdf, $radius, 0.0); - cpdf_lineto($pdf, $radius-$margin/3, 0.0); - cpdf_stroke($pdf); - } - - cpdf_restore($pdf); - cpdf_save($pdf); - - /* 5 minute strokes */ - cpdf_setlinewidth($pdf, 3.0); - for ($alpha = 0; $alpha < 360; $alpha += 30) { - cpdf_rotate($pdf, 30.0); - cpdf_moveto($pdf, $radius, 0.0); - cpdf_lineto($pdf, $radius-$margin, 0.0); - cpdf_stroke($pdf); - } - - $ltime = getdate(); - - /* draw hour hand */ - cpdf_save($pdf); - cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0); - cpdf_moveto($pdf, -$radius/10, -$radius/20); - cpdf_lineto($pdf, $radius/2, 0.0); - cpdf_lineto($pdf, -$radius/10, $radius/20); - cpdf_closepath($pdf); - cpdf_fill($pdf); - cpdf_restore($pdf); - - /* draw minute hand */ - cpdf_save($pdf); - cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0); - cpdf_moveto($pdf, -$radius/10, -$radius/20); - cpdf_lineto($pdf, $radius * 0.8, 0.0); - cpdf_lineto($pdf, -$radius/10, $radius/20); - cpdf_closepath($pdf); - cpdf_fill($pdf); - cpdf_restore($pdf); - - /* draw second hand */ - cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0); - cpdf_setlinewidth($pdf, 2); - cpdf_save($pdf); - cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0)); - cpdf_moveto($pdf, -$radius/5, 0.0); - cpdf_lineto($pdf, $radius, 0.0); - cpdf_stroke($pdf); - cpdf_restore($pdf); - - /* draw little circle at center */ - cpdf_circle($pdf, 0, 0, $radius/30); - cpdf_fill($pdf); - - cpdf_restore($pdf); - - cpdf_finalize_page($pdf, $pagecount+1); -} - -cpdf_finalize($pdf); -Header("Content-type: application/pdf"); -cpdf_output_buffer($pdf); -cpdf_close($pdf); -?> -]]> - </programlisting> - </example> - </section> - - <section xml:id="cpdf.seealso"> - &reftitle.seealso; - <para> - See also the <link linkend="ref.pdf">PDFlib</link> - extension documentation. - </para> - </section> - </partintro> - -&reference.cpdf.entities.functions; - - </reference> +</reference> <!-- Keep this comment at the end of the file Local variables:
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/book.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/cpdf/book.xml diff -u /dev/null phpdoc/en/reference/cpdf/book.xml:1.2 --- /dev/null Thu Dec 13 20:00:04 2007 +++ phpdoc/en/reference/cpdf/book.xml Thu Dec 13 20:00:04 2007 @@ -0,0 +1,106 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.2 $ --> +<!-- Purpose: utilspec.nontext --> +<!-- Membership: pecl, external --> +<!-- State: deprecated --> + +<book xml:id="book.cpdf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>ClibPDF</title> + + <!-- {{{ preface --> + <preface xml:id="intro.cpdf"> + &reftitle.intro; + <warning> + <para> + ClibPDF support is deprecated and users are strongly encouraged to use + an alternative, like <link linkend="book.haru">Haru</link>, + <link linkend="book.pdf">PDFlib</link>, or one of the available + <link linkend="faq.using.freepdf">PHP alternatives.</link> + </para> + </warning> + <para> + ClibPDF lets you create PDF documents with PHP. ClibPDF functionality + and API are similar to <link linkend="book.pdf">PDFlib</link>. + This documentation should be read alongside the ClibPDF manual since it + explains the library in much greater detail. + </para> + <para> + Many functions in the native ClibPDF and the PHP module, as well + as in <link linkend="book.pdf">PDFlib</link>, have the same name. + All functions except for <function>cpdf_open</function> take the + handle for the document as their first parameter. + </para> + <para> + Currently this handle is not used internally since ClibPDF does + not support the creation of several PDF documents at the same time. + Actually, you should not even try it, the results are unpredictable. I + can't oversee what the consequences in a multi threaded environment + are. According to the author of ClibPDF this will change in one of + the next releases (current version when this was written is 1.10). + If you need this functionality use the pdflib module. + </para> + <para> + A nice feature of ClibPDF (and <link + linkend="book.pdf">PDFlib</link>) is the ability to create the pdf + document completely in memory without using temporary files. It + also provides the ability to pass coordinates in a predefined unit + length. (This feature can also be simulated by + <function>pdf_translate</function> when using the <link + linkend="book.pdf">PDFlib</link> functions.) + </para> + <para> + Another nice feature of ClibPDF is the fact that any page can be modified + at any time even if a new page has been already opened. The function + <function>cpdf_set_current_page</function> allows to leave the current + page and presume modifying an other page. + </para> + <para> + Most of the functions are fairly easy to use. The most difficult part + is probably creating a very simple PDF document at all. The following + example should help you to get started. It creates a document + with one page. The page contains the text "Times-Roman" in an + outlined 30pt font. The text is underlined. + </para> + <note> + <para> + &pecl.moved-ver;5.1.0. + </para> + </note> + <note> + <simpara> + If you're interested in alternative free PDF generators that do not + utilize external PDF libraries, see <link linkend="faq.using.freepdf"> + this related FAQ</link>. + </simpara> + </note> + </preface> + <!-- }}} --> + + &reference.cpdf.setup; + &reference.cpdf.constants; + &reference.cpdf.examples; + &reference.cpdf.reference; + +</book> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/examples.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/cpdf/examples.xml diff -u /dev/null phpdoc/en/reference/cpdf/examples.xml:1.2 --- /dev/null Thu Dec 13 20:00:04 2007 +++ phpdoc/en/reference/cpdf/examples.xml Thu Dec 13 20:00:04 2007 @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- $Revision: 1.2 $ --> + +<chapter xml:id="cpdf.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + &reftitle.examples; + <example> + <title>Simple ClibPDF Example</title> + <programlisting role="php"> +<![CDATA[ +<?php +$cpdf = cpdf_open(0); +cpdf_page_init($cpdf, 1, 0, 595, 842, 1.0); +cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1"); +cpdf_begin_text($cpdf); +cpdf_set_font($cpdf, "Times-Roman", 30, "WinAnsiEncoding"); +cpdf_set_text_rendering($cpdf, 1); +cpdf_text($cpdf, "Times Roman outlined", 50, 50); +cpdf_end_text($cpdf); +cpdf_moveto($cpdf, 50, 50); +cpdf_lineto($cpdf, 740, 330); +cpdf_stroke($cpdf); +cpdf_finalize_page($cpdf, 1); +cpdf_finalize($cpdf); +Header("Content-type: application/pdf"); +cpdf_output_buffer($cpdf); +cpdf_close($cpdf); +?> +]]> + </programlisting> + </example> + <para> + The pdflib distribution contains a more complex example which creates a + series of pages with an analog clock. Here is that example converted + into PHP using the ClibPDF extension: + </para> + <example> + <title>pdfclock example from pdflib 2.0 distribution</title> + <programlisting role="php"> +<![CDATA[ +<?php +$radius = 200; +$margin = 20; +$pagecount = 40; + +$pdf = cpdf_open(0); +cpdf_set_creator($pdf, "pdf_clock.php"); +cpdf_set_title($pdf, "Analog Clock"); + +while ($pagecount-- > 0) { + cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0); + + cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0); /* wipe */ + + cpdf_translate($pdf, $radius + $margin, $radius + $margin); + cpdf_save($pdf); + cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0); + + /* minute strokes */ + cpdf_setlinewidth($pdf, 2.0); + for ($alpha = 0; $alpha < 360; $alpha += 6) { + cpdf_rotate($pdf, 6.0); + cpdf_moveto($pdf, $radius, 0.0); + cpdf_lineto($pdf, $radius-$margin/3, 0.0); + cpdf_stroke($pdf); + } + + cpdf_restore($pdf); + cpdf_save($pdf); + + /* 5 minute strokes */ + cpdf_setlinewidth($pdf, 3.0); + for ($alpha = 0; $alpha < 360; $alpha += 30) { + cpdf_rotate($pdf, 30.0); + cpdf_moveto($pdf, $radius, 0.0); + cpdf_lineto($pdf, $radius-$margin, 0.0); + cpdf_stroke($pdf); + } + + $ltime = getdate(); + + /* draw hour hand */ + cpdf_save($pdf); + cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0); + cpdf_moveto($pdf, -$radius/10, -$radius/20); + cpdf_lineto($pdf, $radius/2, 0.0); + cpdf_lineto($pdf, -$radius/10, $radius/20); + cpdf_closepath($pdf); + cpdf_fill($pdf); + cpdf_restore($pdf); + + /* draw minute hand */ + cpdf_save($pdf); + cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0); + cpdf_moveto($pdf, -$radius/10, -$radius/20); + cpdf_lineto($pdf, $radius * 0.8, 0.0); + cpdf_lineto($pdf, -$radius/10, $radius/20); + cpdf_closepath($pdf); + cpdf_fill($pdf); + cpdf_restore($pdf); + + /* draw second hand */ + cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0); + cpdf_setlinewidth($pdf, 2); + cpdf_save($pdf); + cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0)); + cpdf_moveto($pdf, -$radius/5, 0.0); + cpdf_lineto($pdf, $radius, 0.0); + cpdf_stroke($pdf); + cpdf_restore($pdf); + + /* draw little circle at center */ + cpdf_circle($pdf, 0, 0, $radius/30); + cpdf_fill($pdf); + + cpdf_restore($pdf); + + cpdf_finalize_page($pdf, $pagecount+1); +} + +cpdf_finalize($pdf); +Header("Content-type: application/pdf"); +cpdf_output_buffer($pdf); +cpdf_close($pdf); +?> +]]> + </programlisting> + </example> +</chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/setup.xml?r1=1.1&r2=1.2&diff_format=u Index: phpdoc/en/reference/cpdf/setup.xml diff -u /dev/null phpdoc/en/reference/cpdf/setup.xml:1.2 --- /dev/null Thu Dec 13 20:00:04 2007 +++ phpdoc/en/reference/cpdf/setup.xml Thu Dec 13 20:00:04 2007 @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- $Revision: 1.2 $ --> + +<chapter xml:id="cpdf.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + &reftitle.setup; + + <!-- {{{ Requirements --> + <section xml:id="cpdf.requirements"> + &reftitle.required; + <para> + In order to use the ClibPDF functions you need to install the ClibPDF + package. It is available for download from <link xlink:href="&url.fastio;"> + FastIO</link>, but requires that you purchase a license for commercial + use. PHP requires that you use cpdflib >= 2. + The development of ClibPDF library has been discontinued thus FastIO + website would be most probably inaccessible. + </para> + </section> + <!-- }}} --> + + <!-- {{{ Installation --> + &reference.cpdf.configure; + <!-- }}} --> + + <!-- {{{ Configuration --> + <section xml:id="cpdf.configuration"> + &reftitle.runtime; + &no.config; + </section> + <!-- }}} --> + + <!-- {{{ Resources --> + <section xml:id="cpdf.resources"> + &reftitle.resources; + &no.resource; + </section> + <!-- }}} --> + +</chapter> + +<!-- Keep this comment at the end of the file +Local variables: +mode: sgml +sgml-omittag:t +sgml-shorttag:t +sgml-minimize-attributes:nil +sgml-always-quote-attributes:t +sgml-indent-step:1 +sgml-indent-data:t +indent-tabs-mode:nil +sgml-parent-document:nil +sgml-default-dtd-file:"../../../manual.ced" +sgml-exposed-tags:nil +sgml-local-catalogs:nil +sgml-local-ecat-files:nil +End: +vim600: syn=xml fen fdm=syntax fdl=2 si +vim: et tw=78 syn=sgml +vi: ts=1 sw=1 +--> + http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/constants.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/cpdf/constants.xml diff -u phpdoc/en/reference/cpdf/constants.xml:1.3 phpdoc/en/reference/cpdf/constants.xml:1.4 --- phpdoc/en/reference/cpdf/constants.xml:1.3 Wed Jun 20 22:24:17 2007 +++ phpdoc/en/reference/cpdf/constants.xml Thu Dec 13 20:00:04 2007 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> -<section xml:id="cpdf.constants" xmlns="http://docbook.org/ns/docbook"> +<!-- $Revision: 1.4 $ --> +<appendix xml:id="cpdf.constants" xmlns="http://docbook.org/ns/docbook"> &reftitle.constants; &extension.constants; <variablelist> @@ -93,7 +93,7 @@ </listitem> </varlistentry> </variablelist> -</section> +</appendix> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/cpdf/reference.xml?r1=1.19&r2=1.20&diff_format=u Index: phpdoc/en/reference/cpdf/reference.xml diff -u phpdoc/en/reference/cpdf/reference.xml:1.19 phpdoc/en/reference/cpdf/reference.xml:1.20 --- phpdoc/en/reference/cpdf/reference.xml:1.19 Mon Dec 10 17:06:01 2007 +++ phpdoc/en/reference/cpdf/reference.xml Thu Dec 13 20:00:04 2007 @@ -1,240 +1,20 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.19 $ --> -<!-- Purpose: utilspec.nontext --> -<!-- Membership: pecl, external --> -<!-- State: deprecated --> +<!-- $Revision: 1.20 $ --> - <reference xml:id="ref.cpdf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> - <title>ClibPDF Functions [deprecated]</title> - <titleabbrev>ClibPDF</titleabbrev> +<reference xml:id="ref.cpdf" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> + <title>ClibPDF &Functions; [deprecated]</title> - <partintro> - <section xml:id="cpdf.intro"> - &reftitle.intro; - <warning> - <para> - ClibPDF support is deprecated and users are strongly encouraged to use - an alternative, like <link linkend="ref.haru">Haru</link>, - <link linkend="ref.pdf">PDFlib</link>, or one of the available - <link linkend="faq.using.freepdf">PHP alternatives.</link> - </para> - </warning> - <para> - ClibPDF lets you create PDF documents with PHP. ClibPDF functionality - and API are similar to <link linkend="ref.pdf">PDFlib</link>. - This documentation should be read alongside the ClibPDF manual since it - explains the library in much greater detail. - </para> - <para> - Many functions in the native ClibPDF and the PHP module, as well - as in <link linkend="ref.pdf">PDFlib</link>, have the same name. - All functions except for <function>cpdf_open</function> take the - handle for the document as their first parameter. - </para> - <para> - Currently this handle is not used internally since ClibPDF does - not support the creation of several PDF documents at the same time. - Actually, you should not even try it, the results are unpredictable. I - can't oversee what the consequences in a multi threaded environment - are. According to the author of ClibPDF this will change in one of - the next releases (current version when this was written is 1.10). - If you need this functionality use the pdflib module. - </para> - <para> - A nice feature of ClibPDF (and <link - linkend="ref.pdf">PDFlib</link>) is the ability to create the pdf - document completely in memory without using temporary files. It - also provides the ability to pass coordinates in a predefined unit - length. (This feature can also be simulated by - <function>pdf_translate</function> when using the <link - linkend="ref.pdf">PDFlib</link> functions.) - </para> - <para> - Another nice feature of ClibPDF is the fact that any page can be modified - at any time even if a new page has been already opened. The function - <function>cpdf_set_current_page</function> allows to leave the current - page and presume modifying an other page. - </para> - <para> - Most of the functions are fairly easy to use. The most difficult part - is probably creating a very simple PDF document at all. The following - example should help you to get started. It creates a document - with one page. The page contains the text "Times-Roman" in an - outlined 30pt font. The text is underlined. - </para> - <note> - <para> - &pecl.moved-ver;5.1.0. - </para> - </note> - <note> - <simpara> - If you're interested in alternative free PDF generators that do not - utilize external PDF libraries, see <link linkend="faq.using.freepdf"> - this related FAQ</link>. - </simpara> - </note> - </section> - - <section xml:id="cpdf.requirements"> - &reftitle.required; - <para> - In order to use the ClibPDF functions you need to install the ClibPDF - package. It is available for download from <link xlink:href="&url.fastio;"> - FastIO</link>, but requires that you purchase a license for commercial - use. PHP requires that you use cpdflib >= 2. - The development of ClibPDF library has been discontinued thus FastIO - website would be most probably inaccessible. - </para> - </section> + <partintro xml:id="cpdf.seealso"> + &reftitle.seealso; + <para> + See also the <link linkend="ref.pdf">PDFlib</link> + extension documentation. + </para> + </partintro> - &reference.cpdf.configure; + &reference.cpdf.entities.functions; - <section xml:id="cpdf.configuration"> - &reftitle.runtime; - &no.config; - </section> - - &reference.cpdf.constants; - - <section xml:id="cpdf.examples"> - &reftitle.examples; - <example> - <title>Simple ClibPDF Example</title> - <programlisting role="php"> -<![CDATA[ -<?php -$cpdf = cpdf_open(0); -cpdf_page_init($cpdf, 1, 0, 595, 842, 1.0); -cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1"); -cpdf_begin_text($cpdf); -cpdf_set_font($cpdf, "Times-Roman", 30, "WinAnsiEncoding"); -cpdf_set_text_rendering($cpdf, 1); -cpdf_text($cpdf, "Times Roman outlined", 50, 50); -cpdf_end_text($cpdf); -cpdf_moveto($cpdf, 50, 50); -cpdf_lineto($cpdf, 740, 330); -cpdf_stroke($cpdf); -cpdf_finalize_page($cpdf, 1); -cpdf_finalize($cpdf); -Header("Content-type: application/pdf"); -cpdf_output_buffer($cpdf); -cpdf_close($cpdf); -?> -]]> - </programlisting> - </example> - <para> - The pdflib distribution contains a more complex example which creates a - series of pages with an analog clock. Here is that example converted - into PHP using the ClibPDF extension: - </para> - <example> - <title>pdfclock example from pdflib 2.0 distribution</title> - <programlisting role="php"> -<![CDATA[ -<?php -$radius = 200; -$margin = 20; -$pagecount = 40; - -$pdf = cpdf_open(0); -cpdf_set_creator($pdf, "pdf_clock.php"); -cpdf_set_title($pdf, "Analog Clock"); - -while ($pagecount-- > 0) { - cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + $margin), 1.0); - - cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0); /* wipe */ - - cpdf_translate($pdf, $radius + $margin, $radius + $margin); - cpdf_save($pdf); - cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0); - - /* minute strokes */ - cpdf_setlinewidth($pdf, 2.0); - for ($alpha = 0; $alpha < 360; $alpha += 6) { - cpdf_rotate($pdf, 6.0); - cpdf_moveto($pdf, $radius, 0.0); - cpdf_lineto($pdf, $radius-$margin/3, 0.0); - cpdf_stroke($pdf); - } - - cpdf_restore($pdf); - cpdf_save($pdf); - - /* 5 minute strokes */ - cpdf_setlinewidth($pdf, 3.0); - for ($alpha = 0; $alpha < 360; $alpha += 30) { - cpdf_rotate($pdf, 30.0); - cpdf_moveto($pdf, $radius, 0.0); - cpdf_lineto($pdf, $radius-$margin, 0.0); - cpdf_stroke($pdf); - } - - $ltime = getdate(); - - /* draw hour hand */ - cpdf_save($pdf); - cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0); - cpdf_moveto($pdf, -$radius/10, -$radius/20); - cpdf_lineto($pdf, $radius/2, 0.0); - cpdf_lineto($pdf, -$radius/10, $radius/20); - cpdf_closepath($pdf); - cpdf_fill($pdf); - cpdf_restore($pdf); - - /* draw minute hand */ - cpdf_save($pdf); - cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0); - cpdf_moveto($pdf, -$radius/10, -$radius/20); - cpdf_lineto($pdf, $radius * 0.8, 0.0); - cpdf_lineto($pdf, -$radius/10, $radius/20); - cpdf_closepath($pdf); - cpdf_fill($pdf); - cpdf_restore($pdf); - - /* draw second hand */ - cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0); - cpdf_setlinewidth($pdf, 2); - cpdf_save($pdf); - cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0)); - cpdf_moveto($pdf, -$radius/5, 0.0); - cpdf_lineto($pdf, $radius, 0.0); - cpdf_stroke($pdf); - cpdf_restore($pdf); - - /* draw little circle at center */ - cpdf_circle($pdf, 0, 0, $radius/30); - cpdf_fill($pdf); - - cpdf_restore($pdf); - - cpdf_finalize_page($pdf, $pagecount+1); -} - -cpdf_finalize($pdf); -Header("Content-type: application/pdf"); -cpdf_output_buffer($pdf); -cpdf_close($pdf); -?> -]]> - </programlisting> - </example> - </section> - - <section xml:id="cpdf.seealso"> - &reftitle.seealso; - <para> - See also the <link linkend="ref.pdf">PDFlib</link> - extension documentation. - </para> - </section> - </partintro> - -&reference.cpdf.entities.functions; - - </reference> +</reference> <!-- Keep this comment at the end of the file Local variables: