From bc0a028f2375351cf549e98bd9a535ba16ab00d6 Mon Sep 17 00:00:00 2001 From: Rainer Schaaf Date: Wed, 28 Mar 2001 11:59:55 +0000 Subject: [PATCH] The example using getpdf.php was not working with IE5.5. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@44478 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/pdf.xml | 5505 +++++++++++++++++++++++---------------------- 1 file changed, 2753 insertions(+), 2752 deletions(-) diff --git a/functions/pdf.xml b/functions/pdf.xml index 342f738628..743233a46e 100644 --- a/functions/pdf.xml +++ b/functions/pdf.xml @@ -1,1534 +1,1535 @@ - - PDF functions - PDF - - - - Introduction - - You can use the PDF functions in PHP to create PDF files if you - have the PDF library by Thomas Merz (available at - &url.pdf;; - you will also need the JPEG library - and the TIFF library to - compile this. These two libs also quite often make problems when - configuring php. Follow the messages of configure to fix possible - problems. - - - Please consult the excellent documentation for - PDFlib shipped with the source distribution of PDFlib. - It provides a very good overview of what PDFlib capable of doing - and contains the full and uptodate description of all functions. - - - All of the functions in PDFlib and the PHP module have the same name. - The parameters are also identical. - You should also understand some of the concepts of PDF - or Postscript to efficiently use this module. - 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. - - - There is another PHP module for pdf document creation based on - FastIO's. - ClibPDF. It has a slightly different API. Check the - ClibPDF functions section for - details. - - - The pdf module introduces one new type of variable. - It is called pdf object and - almost all functions need pdf object - as its first parameter. - - - - Confusion with old PDFlib versions - - Starting with php V4.0.5 the PHP extension for PDFlib is officially - supported by PDFlib GmbH. This means, that all the functions - described in the PDFlib-manual (V3.00 or greater) are supported by - php4 with exactly the same meaning and the same parameters. - Only the returnvalues may differ from the PDFlib manual, as we - adoptet the PHP way to return FALSE in case of errors. - For compatibility reasons this binding for - PDFlib still will support the old functions, but as stated above - they should be replaced by their new versions. PDFlib GmbH will not - support any problems arraising from the use of these depreciated - functions. - - - - Deprecated functions and its replacements - - - - Old function - Replacement - - - - - PDF_put_image - Not needed anymore. - - - PDF_execute_image - Not needed anymore. - - - PDF_get_annotation - PDF_get_bookmark using the same - parameters. - - - PDF_get_font - PDF_get_value passing - "font" as the second parameter. - - - PDF_get_fontsize - PDF_get_value passing - "fontsize" as the second parameter. - - - PDF_get_fontname - PDF_get_parameter passing - "fontname" as the second parameter. - - - PDF_set_info_creator - PDF_set_info passing - "Creator" as the second parameter. - - - PDF_set_info_title - PDF_set_info passing - "Title" as the second parameter. - - - PDF_set_info_subject - PDF_set_info passing - "Subject" as the second parameter. - - - PDF_set_info_author - PDF_set_info passing - "Author" as the second parameter. - - - PDF_set_info_keywords - PDF_set_info passing - "Keywords" as the second parameter. - - - PDF_set_leading - PDF_set_value passing - "leading" as the second parameter. - - - PDF_set_text_rendering - PDF_set_value passing - "textrendering" as the second parameter. - - - PDF_set_text_rise - PDF_set_value passing - "textrise" as the second parameter. - - - PDF_set_horiz_scaling - PDF_set_value passing - "horizscaling" as the second parameter. - - - PDF_set_text_matrix - Not available anymore - - - PDF_set_char_spacing - PDF_set_value passing - "charspacing" as the second parameter. - - - PDF_set_word_spacing - PDF_set_value passing - "wordspacing" as the second parameter. - - - PDF_set_transition - PDF_set_parameter passing - "transition" as the second parameter. - - - PDF_open - PDF_new plus an subsequent call - of PDF_open_file - - - PDF_set_font - PDF_findfont plus an subsequent call - of PDF_setfont - - - PDF_set_duration - PDF_set_value passing - "duration" as the second parameter. - - - PDF_open_gif - PDF_open_image_file passing - "gif" as the second parameter. - - - PDF_open_jpeg - PDF_open_image_file passing - "jpeg" as the second parameter. - - - PDF_open_tiff - PDF_open_image_file passing - "tiff" as the second parameter. - - - PDF_open_png - PDF_open_image_file passing - "png" as the second parameter. - - - PDF_get_image_width - PDF_get_value passing - "imagewidth" as the second parameter and the image - as the third parameter. - - - PDF_get_image_height - PDF_get_value passing - "imageheight" as the second parameter and the - image as the third parameter. - - - - - - - -
-
-
- - Hints for installation of PDFlib 3.x - - Since version 3.0 of PDFlib you should configure PDFlib with the option - --enable-shared-pdflib. - - - - Issues with older versions of PDFlib - - Any version of PHP 4 after March, 9th 2000 do not support versions - of PDFlib older than 3.0. - - - PHP 3 on the other hand should not be used with version newer - than 2.01. Since revision 1.61 of php3/functions/pdf.c (php 3.19) - it is save to use PDFlib 3.0 or greater. - - - - Examples - - Most of the functions are fairly easy to use. The most difficult part - is probably to create a very simple pdf document at all. The following - example should help to get started. - It creates the file test.pdf - with one page. The page contains the text "Times Roman outlined" in an - outlined, 30pt font. The text is also underlined. - - - - Creating a PDF document with PDFlib - -<?php -$pdf = PDF_new(); -PDF_open_file($pdf, "test.pdf"); -PDF_set_info($pdf, "Author", "Uwe Steinmann"); -PDF_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0"); -PDF_set_info($pdf, "Creator", "See Author"); -PDF_set_info($pdf, "Subject", "Testing"); -PDF_begin_page($pdf, 595, 842); -PDF_add_outline($pdf, "Page 1"); -PDF_set_font($pdf, "Times-Roman", 30, "host"); -PDF_set_value($pdf, "textrendering", 1); -PDF_show_xy($pdf, "Times Roman outlined", 50, 750); -PDF_moveto($pdf, 50, 740); -PDF_lineto($pdf, 330, 740); -PDF_stroke($pdf); -PDF_end_page($pdf); -PDF_close($pdf); -PDF_delete($pdf); -echo "<A HREF=getpdf.php>finished</A>"; -?> - - - The script getpdf.php just returns the pdf document. - - - -<?php -$fp = fopen("test.pdf", "r"); -header("Content-type: application/pdf"); -fpassthru($fp); -fclose($fp); -?> - - - - - - The PDFlib distribution contains a more complex example which - creates a page with an analog clock. Here we use - the in memory creation feature of PDFlib, so we don't need - any tmp-files. This example - converted into PHP using PDFlib looks as the following (you - can see the same example in the documentation for the - clibpdf module): - - - - pdfclock example from PDFlib distribution - -<?php -$radius = 200; -$margin = 20; -$pagecount = 10; - -$pdf = PDF_new(); - -if (!PDF_open_file($pdf, "")) { - print error; - exit; -}; - -PDF_set_parameter($pdf, "warning", "true"); - -PDF_set_info($pdf, "Creator", "pdf_clock.php"); -PDF_set_info($pdf, "Author", "Uwe Steinmann"); -PDF_set_info($pdf, "Title", "Analog Clock"); - -while($pagecount-- > 0) { - PDF_begin_page($pdf, 2 * ($radius + $margin), 2 * ($radius + $margin)); - - PDF_set_parameter($pdf, "transition", "wipe"); - PDF_set_value($pdf, "duration", 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_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); - } - - $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); - - PDF_restore($pdf); - - PDF_end_page($pdf); - - # to see some difference - sleep(1); -} - -PDF_close($pdf); - -$buf = PDF_get_buffer($pdf); -$len = strlen($buf); - -header("Content-type: application/pdf"); -header("Content-Length: $len"); -header("Content-Disposition: inline; filename=foo.pdf"); -print $buf; - -PDF_delete($pdf); -?> - - - - -
- - - - PDF_add_annotation - Deprecitad: Adds annotation - - - Description - - The PDF_add_outline is replaced by - PDF_add_note - - - See also PDF_add_note. - - - - - - - PDF_add_bookmark - Adds bookmark for current page - - - Description - - - int PDF_add_bookmark - int pdf object - string text - int parent - int open - - - - Add a nested bookmark under parent, or a new top-level - bookmark if parent = 0. Returns a bookmark descriptor - which may be used as parent for subsequent nested bookmarks. - If open = 1, child bookmarks will be folded out, and invisible if open = 0. - - - - - - - PDF_add_launchlink - Add a launch annotation for current page - - - Description - - - int PDF_add_launchlink - int pdf object - double llx - double lly - double urx - double ury - string filename - - - - Add a launch annotation (to a target of arbitrary file type). - - - - - - - PDF_add_locallink - Add a link annotation for current page - - - Description - - - int PDF_add_locallink - int pdf object - double llx - double lly - double urx - double ury - int page - string dest - - - - Add a link annotation to a target within the current PDF file. - - - - - - - PDF_add_note - Add a note annotation for current page - - - Description - - - int PDF_add_note - int pdf object - double llx - double lly - double urx - double ury - string contents - string title - string icon - int open - - - - Add a note annotation. icon is one of of "comment, "insert", "note", - "paragraph", "newparagraph", "key", or "help". - - - - - - - pdf_add_outline - Depriciated: Adds bookmark for current page - - - Description - - Depreciated. - - - See PDF_add_bookmark. - - - - - - - PDF_add_pdflink - Adds file link annotation for current page - - - Description - - - int PDF_add_pdflink - int pdf object - double llx - double lly - double urx - double ury - string filename - int page - string dest - - - - Add a file link annotation (to a PDF target). - - - - - - - PDF_add_thumbnail - Adds thumbnail for current page - - - Description - - - int PDF_add_thumbnail - int pdf object - int image - - - - Add an existing image as thumbnail for the current page. - - - - - - - PDF_add_weblink - Adds weblink for current page - - - Description - - - int PDF_add_weblink - int pdf object - double llx - double lly - double urx - double ury - string url - - - - Add a weblink annotation to a target URL on the Web. - - - - - - - PDF_arc - Draws an arc - - - Description - - - void PDF_arc - int pdf object - double x - double y - double r - double alpha - double beta - - - - Draw a counterclockwise circular arc from alpha to beta degrees - - - - - - - PDF_arcn - Draws an arc - - - Description - - - void PDF_arc - int pdf object - double x - double y - double r - double alpha - double beta - - - - Draw a clockwise circular arc from alpha to beta degrees - - - - - - - PDF_attach_file - Adds a file attachement for current page - - - Description - - - int PDF_attach_file - int pdf object - double llx - double lly - double urx - double ury - string filename - string description - string author - string mimetype - string icon - - - - Add a file attachment annotation. icon is one of "graph, - "paperclip", "pushpin", or "tag". - - - - - - - PDF_begin_page - Starts new page - - - Description - - - void PDF_begin_page - int pdf object - double width - double height - - - - Add a new page to the document. - - - - - - - PDF_begin_pattern - Starts new pattern - - - Description - - - void PDF_begin_pattern - int pdf object - double width - double height - double xstep - double ystep - int painttype - - - - Start a new pattern definition. - - - - - - - PDF_begin_template - Starts new template - - - Description - - - void PDF_begin_template - int pdf object - double width - double height - - - - Start a new template definition. - - - - - - - PDF_circle - Draws a circle - - - Description - - - void PDF_circle - int pdf object - double x - double y - double r - - - - Draw a circle with center (x, y) and radius r. - - - - - - - PDF_clip - Clips to current path - - - Description - - - void PDF_clip - int pdf object - - - - Use the current path as clipping path. - - - - - - - PDF_close - Closes a pdf object - - - Description - - - void PDF_close - int pdf object - - - - Close the generated PDF file, and free all document-related resources. - - - - - - - PDF_closepath - Closes path - - - Description - - - void PDF_closepath - int pdf object - - - - Close the current path. - - - - - - - PDF_closepath_fill_stroke - Closes, fills and strokes current path - - - Description - - - void PDF_closepath_fill_stroke - int pdf object - - - - Close the path, fill, and stroke it. - - - - - - - PDF_closepath_stroke - Closes path and draws line along path - - - Description - - - void PDF_closepath_stroke - int pdf object - - - - Close the path, and stroke it. - - - - - - - PDF_close_image - Closes an image - - - Description - - - void PDF_close_image - int image - - - - Close an image retrieved with one of the - PDF_open_image*() functions. - - - - - - - PDF_close_pdi - - Close the input PDF document - - - - Description - - - void PDF_close_pdi - int pdf object - int dochandle - - - - Close all open page handles, and close the input PDF document. - - - - - - - PDF_close_pdi_page - - Close the page handle - - - - Description - - - void PDF_close_pdi_page - int pdf object - int pagehandle - - - - Close the page handle, and free all page-related resources. - - - - - - - PDF_concat - Concatenate a matrix to the CTM - - - Description - - - void PDF_concat - int pdf object - double a - double b - double c - double d - double e - double f - - - - Concatenate a matrix to the CTM. - - - - - - - PDF_continue_text - Outputs text in next line - - - Description - - - void PDF_continue_text - int pdf object - string text - - - - Print text at the next line. The spacing between lines is determined - by the leading parameter. - - - - - - - PDF_curveto - Draws a curve - - - Description - - - void PDF_curveto - int pdf object - double x1 - double y1 - double x2 - double y2 - double x3 - double y3 - - - - Draw a Bezier curve from the current point, using 3 more control points. - - - - - - - PDF_delete - Deletes a PDF object - - - Description - - - void PDF_delete - int pdf object - - - - Delete the PDF object, and free all internal resources. - - - - - - - PDF_end_page - Ends a page - - - Description - - - void PDF_end_page - int pdf object - - - - Finish the page. - - - - - - - PDF_endpath - Depreciated: Ends current path - - - Description - - Deprecated, use one of the stroke, fill, or clip functions instead. - - - - - - - PDF_end_pattern - Finish pattern - - - Description - - - void PDF_end_pattern - int pdf object - - - - Finish the pattern definition. - - - - - - - PDF_end_template - Finish template - - - Description - - - void PDF_end_template - int pdf object - - - - Finish the template definition. - - - - - - - PDF_fill - Fills current path - - - Description - - - void PDF_fill_stroke - int pdf object - - - - Fill the interior of the path with the current fill color. - - - - - - - PDF_fill_stroke - Fills and strokes current path - - - Description - - - void PDF_fill_stroke - int pdf object - - - - Fill and stroke the path with the current fill and stroke color. - - - - - - - PDF_findfont - Prepare font for later use with PDF_setfont. - - - Description - - - void PDF_findfont - int pdf object - string fontname - string encoding^ - int embed - - - - Prepare a font for later use with PDF_setfont. - The metrics will be loaded, and if embed is nonzero, the font file - will be checked, but not yet used. Encoding is one of "builtin", - "macroman", "winansi", "host", or a user-defined encoding name, - or the name of a CMap. - - - - - - - PDF_get_buffer - Fetch the buffer containig the generated PDF data. - - - Description - - - string PDF_get_buffer - int pdf object - - - - Get the contents of the PDF output buffer. The result must be - used by the client before calling any other PDFlib function. - - - - - - - PDF_get_font - Depreciated font handling - - - Description - - Depreciated. - - - See PDF_get_value. - - - - - - - PDF_get_fontname - Depreciated font handling - - - Description - - Depreciated. - - - See PDF_get_parameter. - - - - - - - PDF_get_fontsize - Depreciated font handling - - - Description - - Depreciated. - - - See PDF_get_value. - - - - - - - PDF_get_image_height - Returns height of an image - - - Description - - - string PDF_get_image_height - int pdf object - int image - - - - The PDF_get_image_height is depreciated, - use PDF_get_value instead. - - - - - - - PDF_get_image_width - Returns width of an image - - - Description - - - string PDF_get_image_width - int pdf object - int image - - - - The PDF_get_image_width is depreciated, - use PDF_get_value instead. - - - - - - - PDF_get_parameter - Gets certain parameters - - - Description - - - string PDF_get_parameter - int pdf object - string key - double modifier - - - - Get the contents of some PDFlib parameter with string type. - - - - - - - PDF_get_pdi_parameter - Get some PDI string parameters - - - Description - - - string PDF_get_pdi_parameter - int pdf object - string key - int doc - int page - int index - - - - Get the contents of some PDI document parameter with string type. - - - - - - - PDF_get_pdi_value - Gets some PDI numerical parameters - - - Description - - - string PDF_get_pdi_value - int pdf object - string key - int doc - int page - int index - - - - Get the contents of some PDI document parameter with numerical type. - - - - - - - PDF_get_value - Gets certain numerical value - - - Description - - - double PDF_get_value - int pdf object - string key - double modifier - - - - Get the contents of some PDFlib parameter with float type. - - - - - - - PDF_initgraphics - Resets graphic state - - - Description - - - void PDF_initgraphics - int pdf object - - - - Reset all implicit color and graphics state parameters to their defaults. - - - - - - - PDF_lineto - Draws a line - - - Description - - - void PDF_lineto - int pdf object - double x - double y - - - - Draw a line from the current point to (x, - y). - - - - - - - PDF_makespotcolor - Makes a spotcolor - - - Description - - - void PDF_makespotcolor - int pdf object - string spotname - - - - Make a named spot color from the current color. - - - - - - - PDF_moveto - Sets current point - - - Description - - - void PDF_moveto - int pdf object - double x - double y - - - - Set the current point. - - - - - - - PDF_new - Creates a new pdf object - - - Description - - - int PDF_new - - - - - Create a new PDF object, using default error handling - and memory management. - - - - - - - pdf_open - Depriciated: Opens a new pdf object - - - Description - - The PDF_open is depreciated, use - PDF_new plus PDF_open_file - instead. - - - See also PDF_new, - PDF_open_file. - - - - - - - PDF_open_CCITT - Opens a new image file with raw CCITT data - - - Description - - - int PDF_open - int pdf object - string filename - int width - int height - int BitReverse - int k - int Blackls1 - - - - Open a raw CCITT image. - - - - - - - PDF_open_file - Opens a new pdf object - - - Description - - - int PDF_open_file - int pdf object - string filename - - - - Create a new PDF file using the supplied file name. - If filename is empty the PDF document - will be generated in memory instead of on file. The result - must be fetched by the client with the - PDF_get_buffer function. - + + PDF functions + PDF + + + + Introduction + + You can use the PDF functions in PHP to create PDF files if you + have the PDF library by Thomas Merz (available at + &url.pdf;; + you will also need the JPEG library + and the TIFF library to + compile this. These two libs also quite often make problems when + configuring php. Follow the messages of configure to fix possible + problems. + + + Please consult the excellent documentation for + PDFlib shipped with the source distribution of PDFlib. + It provides a very good overview of what PDFlib capable of doing + and contains the full and uptodate description of all functions. + + + All of the functions in PDFlib and the PHP module have the same name. + The parameters are also identical. + You should also understand some of the concepts of PDF + or Postscript to efficiently use this module. + 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. + + + There is another PHP module for pdf document creation based on + FastIO's. + ClibPDF. It has a slightly different API. Check the + ClibPDF functions section for + details. + + + The pdf module introduces one new type of variable. + It is called pdf object and + almost all functions need pdf object + as its first parameter. + + + + Confusion with old PDFlib versions + + Starting with php V4.0.5 the PHP extension for PDFlib is officially + supported by PDFlib GmbH. This means, that all the functions + described in the PDFlib-manual (V3.00 or greater) are supported by + php4 with exactly the same meaning and the same parameters. + Only the returnvalues may differ from the PDFlib manual, as we + adoptet the PHP way to return FALSE in case of errors. + For compatibility reasons this binding for + PDFlib still will support the old functions, but as stated above + they should be replaced by their new versions. PDFlib GmbH will not + support any problems arraising from the use of these depreciated + functions. + + + + Deprecated functions and its replacements + + + + Old function + Replacement + + + + + PDF_put_image + Not needed anymore. + + + PDF_execute_image + Not needed anymore. + + + PDF_get_annotation + PDF_get_bookmark using the same + parameters. + + + PDF_get_font + PDF_get_value passing + "font" as the second parameter. + + + PDF_get_fontsize + PDF_get_value passing + "fontsize" as the second parameter. + + + PDF_get_fontname + PDF_get_parameter passing + "fontname" as the second parameter. + + + PDF_set_info_creator + PDF_set_info passing + "Creator" as the second parameter. + + + PDF_set_info_title + PDF_set_info passing + "Title" as the second parameter. + + + PDF_set_info_subject + PDF_set_info passing + "Subject" as the second parameter. + + + PDF_set_info_author + PDF_set_info passing + "Author" as the second parameter. + + + PDF_set_info_keywords + PDF_set_info passing + "Keywords" as the second parameter. + + + PDF_set_leading + PDF_set_value passing + "leading" as the second parameter. + + + PDF_set_text_rendering + PDF_set_value passing + "textrendering" as the second parameter. + + + PDF_set_text_rise + PDF_set_value passing + "textrise" as the second parameter. + + + PDF_set_horiz_scaling + PDF_set_value passing + "horizscaling" as the second parameter. + + + PDF_set_text_matrix + Not available anymore + + + PDF_set_char_spacing + PDF_set_value passing + "charspacing" as the second parameter. + + + PDF_set_word_spacing + PDF_set_value passing + "wordspacing" as the second parameter. + + + PDF_set_transition + PDF_set_parameter passing + "transition" as the second parameter. + + + PDF_open + PDF_new plus an subsequent call + of PDF_open_file + + + PDF_set_font + PDF_findfont plus an subsequent call + of PDF_setfont + + + PDF_set_duration + PDF_set_value passing + "duration" as the second parameter. + + + PDF_open_gif + PDF_open_image_file passing + "gif" as the second parameter. + + + PDF_open_jpeg + PDF_open_image_file passing + "jpeg" as the second parameter. + + + PDF_open_tiff + PDF_open_image_file passing + "tiff" as the second parameter. + + + PDF_open_png + PDF_open_image_file passing + "png" as the second parameter. + + + PDF_get_image_width + PDF_get_value passing + "imagewidth" as the second parameter and the image + as the third parameter. + + + PDF_get_image_height + PDF_get_value passing + "imageheight" as the second parameter and the + image as the third parameter. + + + + + + + +
+
+
+ + Hints for installation of PDFlib 3.x + + Since version 3.0 of PDFlib you should configure PDFlib with the option + --enable-shared-pdflib. + + + + Issues with older versions of PDFlib + + Any version of PHP 4 after March, 9th 2000 do not support versions + of PDFlib older than 3.0. + + + PHP 3 on the other hand should not be used with version newer + than 2.01. Since revision 1.61 of php3/functions/pdf.c (php 3.19) + it is save to use PDFlib 3.0 or greater. + + + + Examples + + Most of the functions are fairly easy to use. The most difficult part + is probably to create a very simple pdf document at all. The following + example should help to get started. + It creates the file test.pdf + with one page. The page contains the text "Times Roman outlined" in an + outlined, 30pt font. The text is also underlined. + + + + Creating a PDF document with PDFlib + +<?php +$pdf = PDF_new(); +PDF_open_file($pdf, "test.pdf"); +PDF_set_info($pdf, "Author", "Uwe Steinmann"); +PDF_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0"); +PDF_set_info($pdf, "Creator", "See Author"); +PDF_set_info($pdf, "Subject", "Testing"); +PDF_begin_page($pdf, 595, 842); +PDF_add_outline($pdf, "Page 1"); +PDF_set_font($pdf, "Times-Roman", 30, "host"); +PDF_set_value($pdf, "textrendering", 1); +PDF_show_xy($pdf, "Times Roman outlined", 50, 750); +PDF_moveto($pdf, 50, 740); +PDF_lineto($pdf, 330, 740); +PDF_stroke($pdf); +PDF_end_page($pdf); +PDF_close($pdf); +PDF_delete($pdf); +echo "<A HREF=getpdf.php>finished</A>"; +?> + + + The script getpdf.php just returns the pdf document. + + + +<?php +$len = filesize($filename); +header("Content-type: application/pdf"); +header("Content-Length: $len"); +header("Content-Disposition: inline; filename=foo.pdf"); +readfile($filename); +?> + + + + + + The PDFlib distribution contains a more complex example which + creates a page with an analog clock. Here we use + the in memory creation feature of PDFlib, so we don't need + any tmp-files. This example + converted into PHP using PDFlib looks as the following (you + can see the same example in the documentation for the + clibpdf module): + + + + pdfclock example from PDFlib distribution + +<?php +$radius = 200; +$margin = 20; +$pagecount = 10; + +$pdf = PDF_new(); + +if (!PDF_open_file($pdf, "")) { + print error; + exit; +}; + +PDF_set_parameter($pdf, "warning", "true"); + +PDF_set_info($pdf, "Creator", "pdf_clock.php"); +PDF_set_info($pdf, "Author", "Uwe Steinmann"); +PDF_set_info($pdf, "Title", "Analog Clock"); + +while($pagecount-- > 0) { + PDF_begin_page($pdf, 2 * ($radius + $margin), 2 * ($radius + $margin)); + + PDF_set_parameter($pdf, "transition", "wipe"); + PDF_set_value($pdf, "duration", 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_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); + } + + $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); + + PDF_restore($pdf); + + PDF_end_page($pdf); + + # to see some difference + sleep(1); +} + +PDF_close($pdf); + +$buf = PDF_get_buffer($pdf); +$len = strlen($buf); + +header("Content-type: application/pdf"); +header("Content-Length: $len"); +header("Content-Disposition: inline; filename=foo.pdf"); +print $buf; + +PDF_delete($pdf); +?> + + + + +
+ + + + PDF_add_annotation + Deprecitad: Adds annotation + + + Description + + The PDF_add_outline is replaced by + PDF_add_note + + + See also PDF_add_note. + + + + + + + PDF_add_bookmark + Adds bookmark for current page + + + Description + + + int PDF_add_bookmark + int pdf object + string text + int parent + int open + + + + Add a nested bookmark under parent, or a new top-level + bookmark if parent = 0. Returns a bookmark descriptor + which may be used as parent for subsequent nested bookmarks. + If open = 1, child bookmarks will be folded out, and invisible if open = 0. + + + + + + + PDF_add_launchlink + Add a launch annotation for current page + + + Description + + + int PDF_add_launchlink + int pdf object + double llx + double lly + double urx + double ury + string filename + + + + Add a launch annotation (to a target of arbitrary file type). + + + + + + + PDF_add_locallink + Add a link annotation for current page + + + Description + + + int PDF_add_locallink + int pdf object + double llx + double lly + double urx + double ury + int page + string dest + + + + Add a link annotation to a target within the current PDF file. + + + + + + + PDF_add_note + Add a note annotation for current page + + + Description + + + int PDF_add_note + int pdf object + double llx + double lly + double urx + double ury + string contents + string title + string icon + int open + + + + Add a note annotation. icon is one of of "comment, "insert", "note", + "paragraph", "newparagraph", "key", or "help". + + + + + + + pdf_add_outline + Depriciated: Adds bookmark for current page + + + Description + + Depreciated. + + + See PDF_add_bookmark. + + + + + + + PDF_add_pdflink + Adds file link annotation for current page + + + Description + + + int PDF_add_pdflink + int pdf object + double llx + double lly + double urx + double ury + string filename + int page + string dest + + + + Add a file link annotation (to a PDF target). + + + + + + + PDF_add_thumbnail + Adds thumbnail for current page + + + Description + + + int PDF_add_thumbnail + int pdf object + int image + + + + Add an existing image as thumbnail for the current page. + + + + + + + PDF_add_weblink + Adds weblink for current page + + + Description + + + int PDF_add_weblink + int pdf object + double llx + double lly + double urx + double ury + string url + + + + Add a weblink annotation to a target URL on the Web. + + + + + + + PDF_arc + Draws an arc + + + Description + + + void PDF_arc + int pdf object + double x + double y + double r + double alpha + double beta + + + + Draw a counterclockwise circular arc from alpha to beta degrees + + + + + + + PDF_arcn + Draws an arc + + + Description + + + void PDF_arc + int pdf object + double x + double y + double r + double alpha + double beta + + + + Draw a clockwise circular arc from alpha to beta degrees + + + + + + + PDF_attach_file + Adds a file attachement for current page + + + Description + + + int PDF_attach_file + int pdf object + double llx + double lly + double urx + double ury + string filename + string description + string author + string mimetype + string icon + + + + Add a file attachment annotation. icon is one of "graph, + "paperclip", "pushpin", or "tag". + + + + + + + PDF_begin_page + Starts new page + + + Description + + + void PDF_begin_page + int pdf object + double width + double height + + + + Add a new page to the document. + + + + + + + PDF_begin_pattern + Starts new pattern + + + Description + + + void PDF_begin_pattern + int pdf object + double width + double height + double xstep + double ystep + int painttype + + + + Start a new pattern definition. + + + + + + + PDF_begin_template + Starts new template + + + Description + + + void PDF_begin_template + int pdf object + double width + double height + + + + Start a new template definition. + + + + + + + PDF_circle + Draws a circle + + + Description + + + void PDF_circle + int pdf object + double x + double y + double r + + + + Draw a circle with center (x, y) and radius r. + + + + + + + PDF_clip + Clips to current path + + + Description + + + void PDF_clip + int pdf object + + + + Use the current path as clipping path. + + + + + + + PDF_close + Closes a pdf object + + + Description + + + void PDF_close + int pdf object + + + + Close the generated PDF file, and free all document-related resources. + + + + + + + PDF_closepath + Closes path + + + Description + + + void PDF_closepath + int pdf object + + + + Close the current path. + + + + + + + PDF_closepath_fill_stroke + Closes, fills and strokes current path + + + Description + + + void PDF_closepath_fill_stroke + int pdf object + + + + Close the path, fill, and stroke it. + + + + + + + PDF_closepath_stroke + Closes path and draws line along path + + + Description + + + void PDF_closepath_stroke + int pdf object + + + + Close the path, and stroke it. + + + + + + + PDF_close_image + Closes an image + + + Description + + + void PDF_close_image + int image + + + + Close an image retrieved with one of the + PDF_open_image*() functions. + + + + + + + PDF_close_pdi + + Close the input PDF document + + + + Description + + + void PDF_close_pdi + int pdf object + int dochandle + + + + Close all open page handles, and close the input PDF document. + + + + + + + PDF_close_pdi_page + + Close the page handle + + + + Description + + + void PDF_close_pdi_page + int pdf object + int pagehandle + + + + Close the page handle, and free all page-related resources. + + + + + + + PDF_concat + Concatenate a matrix to the CTM + + + Description + + + void PDF_concat + int pdf object + double a + double b + double c + double d + double e + double f + + + + Concatenate a matrix to the CTM. + + + + + + + PDF_continue_text + Outputs text in next line + + + Description + + + void PDF_continue_text + int pdf object + string text + + + + Print text at the next line. The spacing between lines is determined + by the leading parameter. + + + + + + + PDF_curveto + Draws a curve + + + Description + + + void PDF_curveto + int pdf object + double x1 + double y1 + double x2 + double y2 + double x3 + double y3 + + + + Draw a Bezier curve from the current point, using 3 more control points. + + + + + + + PDF_delete + Deletes a PDF object + + + Description + + + void PDF_delete + int pdf object + + + + Delete the PDF object, and free all internal resources. + + + + + + + PDF_end_page + Ends a page + + + Description + + + void PDF_end_page + int pdf object + + + + Finish the page. + + + + + + + PDF_endpath + Depreciated: Ends current path + + + Description + + Deprecated, use one of the stroke, fill, or clip functions instead. + + + + + + + PDF_end_pattern + Finish pattern + + + Description + + + void PDF_end_pattern + int pdf object + + + + Finish the pattern definition. + + + + + + + PDF_end_template + Finish template + + + Description + + + void PDF_end_template + int pdf object + + + + Finish the template definition. + + + + + + + PDF_fill + Fills current path + + + Description + + + void PDF_fill_stroke + int pdf object + + + + Fill the interior of the path with the current fill color. + + + + + + + PDF_fill_stroke + Fills and strokes current path + + + Description + + + void PDF_fill_stroke + int pdf object + + + + Fill and stroke the path with the current fill and stroke color. + + + + + + + PDF_findfont + Prepare font for later use with PDF_setfont. + + + Description + + + void PDF_findfont + int pdf object + string fontname + string encoding^ + int embed + + + + Prepare a font for later use with PDF_setfont. + The metrics will be loaded, and if embed is nonzero, the font file + will be checked, but not yet used. Encoding is one of "builtin", + "macroman", "winansi", "host", or a user-defined encoding name, + or the name of a CMap. + + + + + + + PDF_get_buffer + Fetch the buffer containig the generated PDF data. + + + Description + + + string PDF_get_buffer + int pdf object + + + + Get the contents of the PDF output buffer. The result must be + used by the client before calling any other PDFlib function. + + + + + + + PDF_get_font + Depreciated font handling + + + Description + + Depreciated. + + + See PDF_get_value. + + + + + + + PDF_get_fontname + Depreciated font handling + + + Description + + Depreciated. + + + See PDF_get_parameter. + + + + + + + PDF_get_fontsize + Depreciated font handling + + + Description + + Depreciated. + + + See PDF_get_value. + + + + + + + PDF_get_image_height + Returns height of an image + + + Description + + + string PDF_get_image_height + int pdf object + int image + + + + The PDF_get_image_height is depreciated, + use PDF_get_value instead. + + + + + + + PDF_get_image_width + Returns width of an image + + + Description + + + string PDF_get_image_width + int pdf object + int image + + + + The PDF_get_image_width is depreciated, + use PDF_get_value instead. + + + + + + + PDF_get_parameter + Gets certain parameters + + + Description + + + string PDF_get_parameter + int pdf object + string key + double modifier + + + + Get the contents of some PDFlib parameter with string type. + + + + + + + PDF_get_pdi_parameter + Get some PDI string parameters + + + Description + + + string PDF_get_pdi_parameter + int pdf object + string key + int doc + int page + int index + + + + Get the contents of some PDI document parameter with string type. + + + + + + + PDF_get_pdi_value + Gets some PDI numerical parameters + + + Description + + + string PDF_get_pdi_value + int pdf object + string key + int doc + int page + int index + + + + Get the contents of some PDI document parameter with numerical type. + + + + + + + PDF_get_value + Gets certain numerical value + + + Description + + + double PDF_get_value + int pdf object + string key + double modifier + + + + Get the contents of some PDFlib parameter with float type. + + + + + + + PDF_initgraphics + Resets graphic state + + + Description + + + void PDF_initgraphics + int pdf object + + + + Reset all implicit color and graphics state parameters to their defaults. + + + + + + + PDF_lineto + Draws a line + + + Description + + + void PDF_lineto + int pdf object + double x + double y + + + + Draw a line from the current point to (x, + y). + + + + + + + PDF_makespotcolor + Makes a spotcolor + + + Description + + + void PDF_makespotcolor + int pdf object + string spotname + + + + Make a named spot color from the current color. + + + + + + + PDF_moveto + Sets current point + + + Description + + + void PDF_moveto + int pdf object + double x + double y + + + + Set the current point. + + + + + + + PDF_new + Creates a new pdf object + + + Description + + + int PDF_new + + + + + Create a new PDF object, using default error handling + and memory management. + + + + + + + pdf_open + Depriciated: Opens a new pdf object + + + Description + + The PDF_open is depreciated, use + PDF_new plus PDF_open_file + instead. + + + See also PDF_new, + PDF_open_file. + + + + + + + PDF_open_CCITT + Opens a new image file with raw CCITT data + + + Description + + + int PDF_open + int pdf object + string filename + int width + int height + int BitReverse + int k + int Blackls1 + + + + Open a raw CCITT image. + + + + + + + PDF_open_file + Opens a new pdf object + + + Description + + + int PDF_open_file + int pdf object + string filename + + + + Create a new PDF file using the supplied file name. + If filename is empty the PDF document + will be generated in memory instead of on file. The result + must be fetched by the client with the + PDF_get_buffer function. + The following example shows how to create a pdf document in memory and how to output it correctly. @@ -1559,1224 +1560,1224 @@ echo $data; - - - - - - PDF_open_gif - Depreciated: Opens a GIF image - - - Description - - Depreciated. - - - See PDF_open_image, - - - - - - - PDF_open_image - Versatile function for images - - - Description - - - int PDF_open_image - int PDF-document - string imagetype - string source - string data - long length - int width - int height - int components - int bpc - string params - - - - Use image data from a variety of data sources. Supported types are - "jpeg", "ccitt", "raw". Supported sources are "memory", "fileref", - "url". len is only used for type="raw", params is only - used for type="ccitt". - - - - - - - PDF_open_image_file - Reads an image from a file - - - Description - - - int PDF_open_image_file - int PDF-document - string imagetype - string filename - string stringparam - string intparam - - - - Open an image file. Supported types are "jpeg", "tiff", "gif", - and "png". stringparam is either - "", "mask", "masked", or "page". - intparamis either 0, the image id - of the applied mask, or the page. - - - - - - - PDF_open_jpeg - Depreciated: Opens a JPEG image - - - Description - - Depreciated. - - - See also PDF_open_image, - - - - - - - PDF_open_pdi - - Opens a PDF file - - - - Description - - - void PDF_open_pdi - int pdf object - string filename - string stringparam - int intparam - - - - Open an existing PDF document for later use. - - - - - - - PDF_open_pdi_page - - Prepare a page - - - - Description - - - void PDF_open_pd_pagei - int pdf object - int dochandle - int pagenumber - string pagelabel - - - - Prepare a page for later use with PDF_place_image - - - - - - - PDF_open_png - - Depreciated: Opens a PNG image - - - - Description - - Depreciated. - - - See PDF_open_image. - - - - - - - PDF_open_tiff - Depreciated: Opens a TIFF image - - - Description - - - int PDF_open_tiff - int PDF-document - string filename - - - - Depreciated. - - - See also PDF_open_image, - - - - - - - PDF_place_image - Places an image on the page - - - Description - - - void PDF_place_image - int pdf object - int image - double x - double y - double scale - - - - Place an image with the lower left corner at (x, - y), and scale it. - - - - - - - PDF_place_pdi_page - Places an image on the page - - - Description - - - void PDF_place_pdi_page - int pdf object - int page - double x - double y - double sx - double sy - - - - Place a PDF page with the lower left corner at (x, - y), and scale it. - - - - - - - PDF_rect - Draws a rectangle - - - Description - - - void PDF_rect - int pdf object - double x - double y - double width - double height - - - - Draw a rectangle at lower left (x, y) with width and height. - - - - - - - PDF_restore - Restores formerly saved environment - - - Description - - - void PDF_restore - int pdf object - - - - Restore the most recently saved graphics state. - - - - - - - PDF_rotate - Sets rotation - - - Description - - - void PDF_rotate - int pdf object - double phi - - - - Rotate the coordinate system by phi degrees. - - - - - - - PDF_save - Saves the current environment - - - Description - - - void PDF_save - int pdf object - - - - Save the current graphics state. - - - - - - - PDF_scale - Sets scaling - - - Description - - - void PDF_scale - int pdf object - double x-scale - double y-scale - - - - Scale the coordinate system. - - - - - - - PDF_setcolor - Sets fill and stroke color to CMYK values - - - Description - - - void PDF_secolor - int pdf object - string type - string colorspace - double c1 - double c2 - double c3 - double c4 - - - - Set the current color space and color. type is "fill", - "stroke", or "both". - - - - - - - PDF_setdash - Sets dash pattern - - - Description - - - void PDF_setdash - int pdf object - double w - double b - - - - Set the current dash pattern to b black and w white units. - - - - - - - PDF_setflat - Sets flatness - - - Description - - - void PDF_setflat - int pdf object - double flatness - - - - Set the flatness to a value between 0 and 100 inclusive. - - - - - - - PDF_setfont - Set the current font - - - Description - - - void PDF_setfont - int pdf object - int font - double size - - - - Set the current font in the given size, using a - font handle returned by - PDF_findfont - - - - - - - PDF_setgray - Sets drawing and filling color to gray value - - - Description - - - void PDF_setgray - int pdf object - double gray - - - - Set the current fill and stroke color. - - - - PDFlib V4.0: Depreciated, use PDF_setcolor instead. - - - - - - - - PDF_setgray_fill - Sets filling color to gray value - - - Description - - - void PDF_setgray_fill - int pdf object - double gray - - - - Set the current fill color to a gray value between 0 and 1 inclusive. - - - - PDFlib V4.0: Depreciated, use PDF_setcolor instead. - - - - - - - - PDF_setgray_stroke - Sets drawing color to gray value - - - Description - - - void PDF_setgray_stroke - int pdf object - double gray - - - - Set the current stroke color to a gray value between 0 and 1 inclusive - - - - PDFlib V4.0: Depreciated, use PDF_setcolor instead. - - - - - - - - PDF_setlinecap - Sets linecap parameter - - - Description - - - void PDF_setlinecap - int pdf object - int linecap - - - - Set the linecap parameter to a value between 0 and 2 inclusive. - - - - - - - PDF_setlinejoin - Sets linejoin parameter - - - Description - - - void PDF_setlinejoin - int pdf object - long linejoin - - - - Set the line join parameter to a value between 0 and 2 inclusive. - - - - - - - PDF_setlinewidth - Sets line width - - - Description - - - void PDF_setlinewidth - int pdf object - double width - - - - Set the current linewidth to width. - - - - - - - PDF_setmatrix - Sets current transformation matrix - - - Description - - - void PDF_setmatrix - int pdf object - double a - double b - double c - double d - double e - double f - - - - Explicitly set the current transformation matrix. - - - - - - - PDF_setmiterlimit - Sets miter limit - - - Description - - - void PDF_setmiterlimit - int pdf object - double miter - - - - Set the miter limit to a value greater than or equal to 1. - - - - - - - PDF_setpolydash - Sets complicated dash pattern - - - Description - - - void PDF_setpolydash - int pdf object - double *dasharray - - - - Set a more complicated dash pattern defined by an array. - - - - - - - PDF_setrgbcolor - Sets drawing and filling color to rgb color value - - - Description - - - void PDF_setrgbcolor - int pdf object - double red value - double green value - double blue value - - - - Set the current fill and stroke color to the supplied RGB values. - - - - PDFlib V4.0: Depreciated, use PDF_setcolor instead. - - - - - - - - PDF_setrgbcolor_fill - Sets filling color to rgb color value - - - Description - - - void PDF_setrgbcolor_fill - int pdf object - double red value - double green value - double blue value - - - - Set the current fill color to the supplied RGB values. - - - - PDFlib V4.0: Depreciated, use PDF_setcolor instead. - - - - - - - - PDF_setrgbcolor_stroke - Sets drawing color to rgb color value - - - Description - - - void PDF_setrgbcolor_stroke - int pdf object - double red value - double green value - double blue value - - - - Set the current stroke color to the supplied RGB values. - - - - PDFlib V4.0: Depreciated, use PDF_setcolor instead. - - - - - - - - PDF_set_border_color - Sets color of border around links and annotations - - - Description - - - void PDF_set_border_color - int pdf object - double red - double green - double blue - - - - Set the border color for all kinds of annotations. - - - - - - - PDF_set_border_dash - Sets dash style of border around links and annotations - - - Description - - - void PDF_set_border_dash - int pdf object - double black - double white - - - - Set the border dash style for all kinds of annotations. - See PDF_setdash. - - - - - - - PDF_set_border_style - Sets style of border around links and annotations - - - Description - - - void PDF_set_border_style - int pdf object - string style - double width - - - - Set the border style for all kinds of annotations. - style is "solid" or "dashed". - - - - - - - PDF_set_char_spacing - Depreciated: Sets character spacing - - - Description - - Depreciated. - - - See also PDF_set_value, - - - - - - - pdf_set_duration - Depriciated: Sets duration between pages - - - Description - - Depreciated. - - - See PDF_set_value. - - - - - - - PDF_set_font - Depreciated: Selects a font face and size - - - Description - - Depreciated. You should use PDF_findfont plus - PDF_setfont instead. - - - See PDF_findfont, - PDF_setfont. - - - - - - - PDF_set_horiz_scaling - Sets horizontal scaling of text - - - Description - - - void PDF_set_horiz_scaling - int pdf object - double scale - - - - Depreciated. - - - See also PDF_set_value, - - - - - - - PDF_set_info - Fills a field of the document information - - - Description - - - void PDF_set_info - int pdf object - string key - string value - - - - Fill document information field key with value. - key is one of "Subject", "Title", "Creator", - "Author", "Keywords", or a user-defined key. - - - - - - - PDF_set_leading - Depreciated: Sets distance between text lines - - - Description - - Depreciated. - - - See also PDF_set_value, - - - - - - - PDF_set_parameter - Sets certain parameters - - - Description - - - void PDF_set_parameter - int pdf object - string key - string value - - - - Set some PDFlib parameter with string type. - - - - - - - PDF_set_text_pos - Sets text position - - - Description - - - void PDF_set_text_pos - int pdf object - double x - double y - - - - Set the text output position. - - - - - - - PDF_set_text_rendering - Depreciated: Determines how text is rendered - - - Description - - Depreciated. - - - See PDF_set_value, - - - - - - - pdf_set_text_rise - Depriciated: Sets the text rise - - - Description - - Depreciated. - - - See PDF_set_value, - - - - - - - pdf_set_text_matrix - Depriciated: Sets the text matrix - - - Description - - See PDF_set_paramter. - - - - - - - PDF_set_value - Sets certain numerical value - - - Description - - - void PDF_set_value - int pdf object - string key - double value - - - - Set the value of some PDFlib parameter with float type. - - - - - - - pdf_set_word_spacing - Depriciated: Sets spacing between words - - - Description - - Depreciated. - - - See also PDF_set_value, - - - - - - - PDF_show - Output text at current position - - - Description - - - void PDF_show - int pdf object - string text - - - - Print text in the current font and size at the current position. - - - - - - - PDF_show_boxed - Output text in a box - - - Description - - - int PDF_show_boxed - int pdf object - string text - double left - double top - double width - double height - string hmode - string feature - - - - Format text in the current font and size into the supplied text box - according to the requested formatting mode, which must be one of - "left", "right", "center", "justify", or "fulljustify". - If width and height are 0, only a single line is placed at the point - (left, top) in the requested mode. - - - - - - - PDF_show_xy - Output text at given position - - - Description - - - void PDF_show_xy - int pdf object - string text - double x - double y - - - - Print text in the current font at (x, y). - - - - - - - PDF_skew - Skews the coordinate system - - - Description - - - void PDF_skew - int pdf object - double alpha - double beta - - - - Skew the coordinate system in x and y direction by alpha and - beta degrees. - - - - - - - PDF_stringwidth - Returns width of text using current font - - - Description - - - double PDF_stringwidth - int pdf object - string text - string text - string text - - - - Return the width of text in an arbitrary font. - - - - - - - PDF_stroke - Draws line along path - - - Description - - - void PDF_stroke - int pdf object - - - - Stroke the path with the current color and line width, and clear it. - - - - - - - PDF_translate - Sets origin of coordinate system - - - Description - - - void PDF_translate - int pdf object - double tx - double ty - - - - Translate the origin of the coordinate system. - - - - - - - PDF_open_memory_image - Opens an image created with PHP's image functions - - - Description - - - int PDF_open_memory_image - int pdf object - int image - - - - The PDF_open_memory_image function takes - an image created with the PHP's image functions and makes it available - for the pdf object. The function returns a pdf - image identifier. - - - Including a memory image - -<?php -$im = ImageCreate(100, 100); -$col = ImageColorAllocate($im, 80, 45, 190); -ImageFill($im, 10, 10, $col); -$pim = PDF_open_memory_image($pdf, $im); -ImageDestroy($im); -PDF_place_image($pdf, $pim, 100, 100, 1); -PDF_close_image($pdf, $pim); -?> - - - - - See also PDF_close_image, - PDF_place_image. - - - -
- - +
+
+ + + + PDF_open_gif + Depreciated: Opens a GIF image + + + Description + + Depreciated. + + + See PDF_open_image, + + + + + + + PDF_open_image + Versatile function for images + + + Description + + + int PDF_open_image + int PDF-document + string imagetype + string source + string data + long length + int width + int height + int components + int bpc + string params + + + + Use image data from a variety of data sources. Supported types are + "jpeg", "ccitt", "raw". Supported sources are "memory", "fileref", + "url". len is only used for type="raw", params is only + used for type="ccitt". + + + + + + + PDF_open_image_file + Reads an image from a file + + + Description + + + int PDF_open_image_file + int PDF-document + string imagetype + string filename + string stringparam + string intparam + + + + Open an image file. Supported types are "jpeg", "tiff", "gif", + and "png". stringparam is either + "", "mask", "masked", or "page". + intparamis either 0, the image id + of the applied mask, or the page. + + + + + + + PDF_open_jpeg + Depreciated: Opens a JPEG image + + + Description + + Depreciated. + + + See also PDF_open_image, + + + + + + + PDF_open_pdi + + Opens a PDF file + + + + Description + + + void PDF_open_pdi + int pdf object + string filename + string stringparam + int intparam + + + + Open an existing PDF document for later use. + + + + + + + PDF_open_pdi_page + + Prepare a page + + + + Description + + + void PDF_open_pd_pagei + int pdf object + int dochandle + int pagenumber + string pagelabel + + + + Prepare a page for later use with PDF_place_image + + + + + + + PDF_open_png + + Depreciated: Opens a PNG image + + + + Description + + Depreciated. + + + See PDF_open_image. + + + + + + + PDF_open_tiff + Depreciated: Opens a TIFF image + + + Description + + + int PDF_open_tiff + int PDF-document + string filename + + + + Depreciated. + + + See also PDF_open_image, + + + + + + + PDF_place_image + Places an image on the page + + + Description + + + void PDF_place_image + int pdf object + int image + double x + double y + double scale + + + + Place an image with the lower left corner at (x, + y), and scale it. + + + + + + + PDF_place_pdi_page + Places an image on the page + + + Description + + + void PDF_place_pdi_page + int pdf object + int page + double x + double y + double sx + double sy + + + + Place a PDF page with the lower left corner at (x, + y), and scale it. + + + + + + + PDF_rect + Draws a rectangle + + + Description + + + void PDF_rect + int pdf object + double x + double y + double width + double height + + + + Draw a rectangle at lower left (x, y) with width and height. + + + + + + + PDF_restore + Restores formerly saved environment + + + Description + + + void PDF_restore + int pdf object + + + + Restore the most recently saved graphics state. + + + + + + + PDF_rotate + Sets rotation + + + Description + + + void PDF_rotate + int pdf object + double phi + + + + Rotate the coordinate system by phi degrees. + + + + + + + PDF_save + Saves the current environment + + + Description + + + void PDF_save + int pdf object + + + + Save the current graphics state. + + + + + + + PDF_scale + Sets scaling + + + Description + + + void PDF_scale + int pdf object + double x-scale + double y-scale + + + + Scale the coordinate system. + + + + + + + PDF_setcolor + Sets fill and stroke color to CMYK values + + + Description + + + void PDF_secolor + int pdf object + string type + string colorspace + double c1 + double c2 + double c3 + double c4 + + + + Set the current color space and color. type is "fill", + "stroke", or "both". + + + + + + + PDF_setdash + Sets dash pattern + + + Description + + + void PDF_setdash + int pdf object + double w + double b + + + + Set the current dash pattern to b black and w white units. + + + + + + + PDF_setflat + Sets flatness + + + Description + + + void PDF_setflat + int pdf object + double flatness + + + + Set the flatness to a value between 0 and 100 inclusive. + + + + + + + PDF_setfont + Set the current font + + + Description + + + void PDF_setfont + int pdf object + int font + double size + + + + Set the current font in the given size, using a + font handle returned by + PDF_findfont + + + + + + + PDF_setgray + Sets drawing and filling color to gray value + + + Description + + + void PDF_setgray + int pdf object + double gray + + + + Set the current fill and stroke color. + + + + PDFlib V4.0: Depreciated, use PDF_setcolor instead. + + + + + + + + PDF_setgray_fill + Sets filling color to gray value + + + Description + + + void PDF_setgray_fill + int pdf object + double gray + + + + Set the current fill color to a gray value between 0 and 1 inclusive. + + + + PDFlib V4.0: Depreciated, use PDF_setcolor instead. + + + + + + + + PDF_setgray_stroke + Sets drawing color to gray value + + + Description + + + void PDF_setgray_stroke + int pdf object + double gray + + + + Set the current stroke color to a gray value between 0 and 1 inclusive + + + + PDFlib V4.0: Depreciated, use PDF_setcolor instead. + + + + + + + + PDF_setlinecap + Sets linecap parameter + + + Description + + + void PDF_setlinecap + int pdf object + int linecap + + + + Set the linecap parameter to a value between 0 and 2 inclusive. + + + + + + + PDF_setlinejoin + Sets linejoin parameter + + + Description + + + void PDF_setlinejoin + int pdf object + long linejoin + + + + Set the line join parameter to a value between 0 and 2 inclusive. + + + + + + + PDF_setlinewidth + Sets line width + + + Description + + + void PDF_setlinewidth + int pdf object + double width + + + + Set the current linewidth to width. + + + + + + + PDF_setmatrix + Sets current transformation matrix + + + Description + + + void PDF_setmatrix + int pdf object + double a + double b + double c + double d + double e + double f + + + + Explicitly set the current transformation matrix. + + + + + + + PDF_setmiterlimit + Sets miter limit + + + Description + + + void PDF_setmiterlimit + int pdf object + double miter + + + + Set the miter limit to a value greater than or equal to 1. + + + + + + + PDF_setpolydash + Sets complicated dash pattern + + + Description + + + void PDF_setpolydash + int pdf object + double *dasharray + + + + Set a more complicated dash pattern defined by an array. + + + + + + + PDF_setrgbcolor + Sets drawing and filling color to rgb color value + + + Description + + + void PDF_setrgbcolor + int pdf object + double red value + double green value + double blue value + + + + Set the current fill and stroke color to the supplied RGB values. + + + + PDFlib V4.0: Depreciated, use PDF_setcolor instead. + + + + + + + + PDF_setrgbcolor_fill + Sets filling color to rgb color value + + + Description + + + void PDF_setrgbcolor_fill + int pdf object + double red value + double green value + double blue value + + + + Set the current fill color to the supplied RGB values. + + + + PDFlib V4.0: Depreciated, use PDF_setcolor instead. + + + + + + + + PDF_setrgbcolor_stroke + Sets drawing color to rgb color value + + + Description + + + void PDF_setrgbcolor_stroke + int pdf object + double red value + double green value + double blue value + + + + Set the current stroke color to the supplied RGB values. + + + + PDFlib V4.0: Depreciated, use PDF_setcolor instead. + + + + + + + + PDF_set_border_color + Sets color of border around links and annotations + + + Description + + + void PDF_set_border_color + int pdf object + double red + double green + double blue + + + + Set the border color for all kinds of annotations. + + + + + + + PDF_set_border_dash + Sets dash style of border around links and annotations + + + Description + + + void PDF_set_border_dash + int pdf object + double black + double white + + + + Set the border dash style for all kinds of annotations. + See PDF_setdash. + + + + + + + PDF_set_border_style + Sets style of border around links and annotations + + + Description + + + void PDF_set_border_style + int pdf object + string style + double width + + + + Set the border style for all kinds of annotations. + style is "solid" or "dashed". + + + + + + + PDF_set_char_spacing + Depreciated: Sets character spacing + + + Description + + Depreciated. + + + See also PDF_set_value, + + + + + + + pdf_set_duration + Depriciated: Sets duration between pages + + + Description + + Depreciated. + + + See PDF_set_value. + + + + + + + PDF_set_font + Depreciated: Selects a font face and size + + + Description + + Depreciated. You should use PDF_findfont plus + PDF_setfont instead. + + + See PDF_findfont, + PDF_setfont. + + + + + + + PDF_set_horiz_scaling + Sets horizontal scaling of text + + + Description + + + void PDF_set_horiz_scaling + int pdf object + double scale + + + + Depreciated. + + + See also PDF_set_value, + + + + + + + PDF_set_info + Fills a field of the document information + + + Description + + + void PDF_set_info + int pdf object + string key + string value + + + + Fill document information field key with value. + key is one of "Subject", "Title", "Creator", + "Author", "Keywords", or a user-defined key. + + + + + + + PDF_set_leading + Depreciated: Sets distance between text lines + + + Description + + Depreciated. + + + See also PDF_set_value, + + + + + + + PDF_set_parameter + Sets certain parameters + + + Description + + + void PDF_set_parameter + int pdf object + string key + string value + + + + Set some PDFlib parameter with string type. + + + + + + + PDF_set_text_pos + Sets text position + + + Description + + + void PDF_set_text_pos + int pdf object + double x + double y + + + + Set the text output position. + + + + + + + PDF_set_text_rendering + Depreciated: Determines how text is rendered + + + Description + + Depreciated. + + + See PDF_set_value, + + + + + + + pdf_set_text_rise + Depriciated: Sets the text rise + + + Description + + Depreciated. + + + See PDF_set_value, + + + + + + + pdf_set_text_matrix + Depriciated: Sets the text matrix + + + Description + + See PDF_set_paramter. + + + + + + + PDF_set_value + Sets certain numerical value + + + Description + + + void PDF_set_value + int pdf object + string key + double value + + + + Set the value of some PDFlib parameter with float type. + + + + + + + pdf_set_word_spacing + Depriciated: Sets spacing between words + + + Description + + Depreciated. + + + See also PDF_set_value, + + + + + + + PDF_show + Output text at current position + + + Description + + + void PDF_show + int pdf object + string text + + + + Print text in the current font and size at the current position. + + + + + + + PDF_show_boxed + Output text in a box + + + Description + + + int PDF_show_boxed + int pdf object + string text + double left + double top + double width + double height + string hmode + string feature + + + + Format text in the current font and size into the supplied text box + according to the requested formatting mode, which must be one of + "left", "right", "center", "justify", or "fulljustify". + If width and height are 0, only a single line is placed at the point + (left, top) in the requested mode. + + + + + + + PDF_show_xy + Output text at given position + + + Description + + + void PDF_show_xy + int pdf object + string text + double x + double y + + + + Print text in the current font at (x, y). + + + + + + + PDF_skew + Skews the coordinate system + + + Description + + + void PDF_skew + int pdf object + double alpha + double beta + + + + Skew the coordinate system in x and y direction by alpha and + beta degrees. + + + + + + + PDF_stringwidth + Returns width of text using current font + + + Description + + + double PDF_stringwidth + int pdf object + string text + string text + string text + + + + Return the width of text in an arbitrary font. + + + + + + + PDF_stroke + Draws line along path + + + Description + + + void PDF_stroke + int pdf object + + + + Stroke the path with the current color and line width, and clear it. + + + + + + + PDF_translate + Sets origin of coordinate system + + + Description + + + void PDF_translate + int pdf object + double tx + double ty + + + + Translate the origin of the coordinate system. + + + + + + + PDF_open_memory_image + Opens an image created with PHP's image functions + + + Description + + + int PDF_open_memory_image + int pdf object + int image + + + + The PDF_open_memory_image function takes + an image created with the PHP's image functions and makes it available + for the pdf object. The function returns a pdf + image identifier. + + + Including a memory image + +<?php +$im = ImageCreate(100, 100); +$col = ImageColorAllocate($im, 80, 45, 190); +ImageFill($im, 10, 10, $col); +$pim = PDF_open_memory_image($pdf, $im); +ImageDestroy($im); +PDF_place_image($pdf, $pim, 100, 100, 1); +PDF_close_image($pdf, $pim); +?> + + + + + See also PDF_close_image, + PDF_place_image. + + + +
+ +