CVS update: php3/doc/functions

From: Date: Tue, 08 Jun 1999 19:59:35 +0000
Subject: CVS update: php3/doc/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-6727@lists.php.net to get a copy of this message
Date: Tuesday June 8, 1999 @ 15:59 Author: eschmid Update of /repository/php3/doc/functions In directory php:/tmp/cvs-serv20835 Modified Files: pdf.sgml Log Message: Jade is now happy. Index: php3/doc/functions/pdf.sgml diff -u php3/doc/functions/pdf.sgml:1.24 php3/doc/functions/pdf.sgml:1.25 --- php3/doc/functions/pdf.sgml:1.24 Tue Jun 8 05:16:33 1999 +++ php3/doc/functions/pdf.sgml Tue Jun 8 15:59:34 1999 @@ -33,7 +33,8 @@ some PHP functions had to be altered. Here is a list of changes: <itemizedlist> - <listitem><simpara> + <listitem> + <simpara> The Info structure does not exist anymore. Therefore the function <function>pdf_get_info</function> is obsolete and the functions <function>pdf_set_info_creator</function>, @@ -44,12 +45,16 @@ info structure as the first parameter but the pdf document. This also means that the pdf document must be open before these functions can be called. - </simpara></listitem> + </simpara> + </listitem> + <listitem> + <simpara> The way a new document is opened has changed. The function <function>pdf_open</function> takes only one parameter which is the file handle of a file opened with <function>fopen</function>. - <listitem><simpara> - </itemizedlist> + </simpara> + </listitem> + </itemizedlist> <simpara> The pdf module introduces two new types of variables (if pdflib 2.0 @@ -101,21 +106,28 @@ echo "&lt;A HREF=gettest.php3>finished&lt;/A>"; ?> </programlisting> - <para> - The php3 file gettext.php3 just outputs the pdf document. - <programlisting> + </example> + + <para> + + The php3 file gettext.php3 just outputs the pdf document. + + <informalexample> + <programlisting> &lt;?php - $fp = fopen("test.pdf", "r"); - header("Content-type: application/pdf"); - fpassthru($fp); - fclose($fp); +$fp = fopen("test.pdf", "r"); +header("Content-type: application/pdf"); +fpassthru($fp); +fclose($fp); ?> -</programlisting> - </example> - Doing the same with pdflib 2.0 looks like the following: - <example> - <title>Creating a PDF document with pdflib 2.0</title> - <programlisting> + </programlisting> + </informalexample> + + Doing the same with pdflib 2.0 looks like the following: + + <example> + <title>Creating a PDF document with pdflib 2.0</title> + <programlisting> &lt;?php $fp = fopen("test.pdf", "w"); $pdf = PDF_open($fp); @@ -136,19 +148,19 @@ PDF_close($pdf); echo "&lt;A HREF=gettest.php3>finished&lt;/A>"; ?> - </programlisting> - <para> - The php3 file gettext.php3 is the same as above. - </example> + </programlisting> + <para> + The php3 file gettext.php3 is the same as above. + </example> The pdflib distribution contains a more complex example which creates a serious of pages with an analog clock. This example converted into php using pdflib 2.0 looks as the following (you can see the same example in the documentation for the clibpdf module): - <example> - <title>pdfclock example from pdflib 2.0 distribution</title> - <programlisting> + <example> + <title>pdfclock example from pdflib 2.0 distribution</title> + <programlisting> &lt;?php $pdffilename = "clock.pdf"; $radius = 200; @@ -162,99 +174,97 @@ pdf_set_info_title($pdf, "Analog Clock"); while($pagecount-- > 0) { - pdf_begin_page($pdf, 2 * ($radius + $margin), 2 * ($radius + $margin)); + pdf_begin_page($pdf, 2 * ($radius + $margin), 2 * ($radius + $margin)); - pdf_set_transition($pdf, 4); /* wipe */ - pdf_set_duration($pdf, 0.5); + pdf_set_transition($pdf, 4); /* wipe */ + pdf_set_duration($pdf, 0.5); - pdf_translate($pdf, $radius + $margin, $radius + $margin); - pdf_save($pdf); - pdf_setrgbcolor($pdf, 0.0, 0.0, 1.0); - - /* minute strokes */ - pdf_setlinewidth($pdf, 2.0); - for ($alpha = 0; $alpha < 360; $alpha += 6) - { - pdf_rotate($pdf, 6.0); - pdf_moveto($pdf, $radius, 0.0); - pdf_lineto($pdf, $radius-$margin/3, 0.0); - pdf_stroke($pdf); + pdf_translate($pdf, $radius + $margin, $radius + $margin); + pdf_save($pdf); + pdf_setrgbcolor($pdf, 0.0, 0.0, 1.0); + + /* minute strokes */ + pdf_setlinewidth($pdf, 2.0); + for ($alpha = 0; $alpha < 360; $alpha += 6) { + pdf_rotate($pdf, 6.0); + pdf_moveto($pdf, $radius, 0.0); + pdf_lineto($pdf, $radius-$margin/3, 0.0); + pdf_stroke($pdf); } - pdf_restore($pdf); - pdf_save($pdf); + pdf_restore($pdf); + pdf_save($pdf); - /* 5 minute strokes */ - pdf_setlinewidth($pdf, 3.0); - for ($alpha = 0; $alpha < 360; $alpha += 30) - { - pdf_rotate($pdf, 30.0); - pdf_moveto($pdf, $radius, 0.0); - pdf_lineto($pdf, $radius-$margin, 0.0); - pdf_stroke($pdf); - } + /* 5 minute strokes */ + pdf_setlinewidth($pdf, 3.0); + for ($alpha = 0; $alpha < 360; $alpha += 30) { + pdf_rotate($pdf, 30.0); + pdf_moveto($pdf, $radius, 0.0); + pdf_lineto($pdf, $radius-$margin, 0.0); + pdf_stroke($pdf); + } - $ltime = getdate(); + $ltime = getdate(); - /* draw hour hand */ - pdf_save($pdf); - pdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0); - pdf_moveto($pdf, -$radius/10, -$radius/20); - pdf_lineto($pdf, $radius/2, 0.0); - pdf_lineto($pdf, -$radius/10, $radius/20); - pdf_closepath($pdf); - pdf_fill($pdf); - pdf_restore($pdf); - - /* draw minute hand */ - pdf_save($pdf); - pdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0); - pdf_moveto($pdf, -$radius/10, -$radius/20); - pdf_lineto($pdf, $radius * 0.8, 0.0); - pdf_lineto($pdf, -$radius/10, $radius/20); - pdf_closepath($pdf); - pdf_fill($pdf); - pdf_restore($pdf); - - /* draw second hand */ - pdf_setrgbcolor($pdf, 1.0, 0.0, 0.0); - pdf_setlinewidth($pdf, 2); - pdf_save($pdf); - pdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0)); - pdf_moveto($pdf, -$radius/5, 0.0); - pdf_lineto($pdf, $radius, 0.0); - pdf_stroke($pdf); - pdf_restore($pdf); - - /* draw little circle at center */ - pdf_circle($pdf, 0, 0, $radius/30); - pdf_fill($pdf); + /* draw hour hand */ + pdf_save($pdf); + pdf_rotate($pdf,-(($ltime['minutes']/60.0)+$ltime['hours']-3.0)*30.0); + pdf_moveto($pdf, -$radius/10, -$radius/20); + pdf_lineto($pdf, $radius/2, 0.0); + pdf_lineto($pdf, -$radius/10, $radius/20); + pdf_closepath($pdf); + pdf_fill($pdf); + pdf_restore($pdf); + + /* draw minute hand */ + pdf_save($pdf); + pdf_rotate($pdf,-(($ltime['seconds']/60.0)+$ltime['minutes']-15.0)*6.0); + pdf_moveto($pdf, -$radius/10, -$radius/20); + pdf_lineto($pdf, $radius * 0.8, 0.0); + pdf_lineto($pdf, -$radius/10, $radius/20); + pdf_closepath($pdf); + pdf_fill($pdf); + pdf_restore($pdf); + + /* draw second hand */ + pdf_setrgbcolor($pdf, 1.0, 0.0, 0.0); + pdf_setlinewidth($pdf, 2); + pdf_save($pdf); + pdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0)); + pdf_moveto($pdf, -$radius/5, 0.0); + pdf_lineto($pdf, $radius, 0.0); + pdf_stroke($pdf); + pdf_restore($pdf); - pdf_restore($pdf); + /* draw little circle at center */ + pdf_circle($pdf, 0, 0, $radius/30); + pdf_fill($pdf); - pdf_end_page($pdf); + pdf_restore($pdf); + + pdf_end_page($pdf); } $pdf = pdf_close($pdf); fclose($fp); -echo "<A HREF=gettest.php3?filename=".$pdffilename.">finished</A>"; +echo "&lt;A HREF=gettest.php3?filename=".$pdffilename.">finished&lt;/A>"; ?> - </programlisting> - <para> - The php3 file gettext.php3 just outputs the pdf document. - <programlisting> + </programlisting> + <para> + The php3 file gettext.php3 just outputs the pdf document. + <programlisting> &lt;?php - if($filename) +if($filename) $fp = fopen($filename, "r"); - else +else $fp = fopen("test.pdf", "r"); - header("Content-type: application/pdf"); - fpassthru($fp); - fclose($fp); +header("Content-type: application/pdf"); +fpassthru($fp); +fclose($fp); ?> -</programlisting> - </example> - </partintro> + </programlisting> + </example> + </partintro> <refentry id="function.pdf-get-info"> <refnamediv>

« previous php.dev (#6727) next »