PHP PDF Functions

EditRocket provides the following information on PDF functions in the PHP source code builder.

bool PDF_activate_item ( resource $pdfdoc , int $id ) - Activates a previously created structure element or other content item. Returns TRUE on success or FALSE on failure.

-

-

bool PDF_add_launchlink ( resource $pdfdoc , float $llx , float $lly , float $urx , float $ury , string $filename ) - Adds a link to a web resource.

bool PDF_add_locallink ( resource $pdfdoc , float $lowerleftx , float $lowerlefty , float $upperrightx , float $upperrighty , int $page , string $dest ) - Add a link annotation to a target within the current PDF file. Returns TRUE on success or FALSE on failure.

bool PDF_add_nameddest ( resource $pdfdoc , string $name , string $optlist ) - Creates a named destination on an arbitrary page in the current document. Returns TRUE on success or FALSE on failure.

bool PDF_add_note ( resource $pdfdoc , float $llx , float $lly , float $urx , float $ury , string $contents , string $title , string $icon , int $open ) - Sets an annotation for the current page. Returns TRUE on success or FALSE on failure.

-

bool PDF_add_pdflink ( resource $pdfdoc , float $bottom_left_x , float $bottom_left_y , float $up_right_x , float $up_right_y , string $filename , int $page , string $dest ) - Add a file link annotation to a PDF target. Returns TRUE on success or FALSE on failure.

int PDF_add_table_cell ( resource $pdfdoc , int $table , int $column , int $row , string $text , string $optlist ) - Adds a cell to a new or existing table.

int PDF_add_textflow ( resource $pdfdoc , int $textflow , string $text , string $optlist ) - Creates a Textflow object, or adds text and explicit options to an existing Textflow.

bool PDF_add_thumbnail ( resource $pdfdoc , int $image ) - Adds an existing image as thumbnail for the current page. Returns TRUE on success or FALSE on failure.

bool PDF_add_weblink ( resource $pdfdoc , float $lowerleftx , float $lowerlefty , float $upperrightx , float $upperrighty , string $url ) - Adds a weblink annotation to a target url on the Web. Returns TRUE on success or FALSE on failure.

bool PDF_arc ( resource $p , float $x , float $y , float $r , float $alpha , float $beta ) - Adds a counterclockwise circular arc.

bool PDF_arcn ( resource $p , float $x , float $y , float $r , float $alpha , float $beta ) -

bool PDF_attach_file ( resource $pdfdoc , float $llx , float $lly , float $urx , float $ury , string $filename , string $description , string $author , string $mimetype , string $icon ) - Adds a file attachment annotation. Returns TRUE on success or FALSE on failure.

int PDF_begin_document ( resource $pdfdoc , string $filename , string $optlist ) - Creates a new PDF file subject to various options.

bool PDF_begin_font ( resource $pdfdoc , string $filename , float $a , float $b , float $c , float $d , float $e , float $f , string $optlist ) - Starts a Type 3 font definition.

bool PDF_begin_glyph ( resource $pdfdoc , string $glyphname , float $wx , float $llx , float $lly , float $urx , float $ury ) - Starts a glyph definition for a Type 3 font.

int PDF_begin_item ( resource $pdfdoc , string $tag , string $optlist ) - Opens a structure element or other content item with attributes supplied as options.

bool PDF_begin_layer ( resource $pdfdoc , int $layer ) - Starts a layer for subsequent output on the page. Returns TRUE on success or FALSE on failure.

bool PDF_begin_page ( resource $pdfdoc , float $width , float $height ) - Adds a new page to the document. Returns TRUE on success or FALSE on failure.

bool PDF_begin_page_ext ( resource $pdfdoc , float $width , float $height , string $optlist ) - Adds a new page to the document, and specifies various options. The parameters width and height are the dimensions of the new page in points. Returns TRUE on success or FALSE on failure.

int PDF_begin_pattern ( resource $pdfdoc , float $width , float $height , float $xstep , float $ystep , int $painttype ) - Starts a new pattern definition.

int PDF_begin_template ( resource $pdfdoc , float $width , float $height ) - Starts a new template definition.

int PDF_begin_template_ext ( resource $pdfdoc , float $width , float $height , string $optlist ) - Starts a new template definition.

bool PDF_circle ( resource $pdfdoc , float $x , float $y , float $r ) - Adds a circle. Returns TRUE on success or FALSE on failure.

bool PDF_clip ( resource $p ) - Uses the current path as clipping path, and terminate the path. Returns TRUE on success or FALSE on failure.

bool PDF_close ( resource $p ) - Closes the generated PDF file, and frees all document-related resources. Returns TRUE on success or FALSE on failure.

bool PDF_close_image ( resource $p , int $image ) -

bool PDF_close_pdi ( resource $p , int $doc ) - Closes all open page handles, and closes the input PDF document. Returns TRUE on success or FALSE on failure.

bool PDF_close_pdi_page ( resource $p , int $page ) - Closes the page handle, and frees all page-related resources. Returns TRUE on success or FALSE on failure.

bool PDF_closepath ( resource $p ) - Closes the current path. Returns TRUE on success or FALSE on failure.

bool PDF_closepath_fill_stroke ( resource $p ) - Closes the path, fills, and strokes it. Returns TRUE on success or FALSE on failure.

bool PDF_closepath_stroke ( resource $p ) - Closes the path, and strokes it. Returns TRUE on success or FALSE on failure.

bool PDF_concat ( resource $p , float $a , float $b , float $c , float $d , float $e , float $f ) - Concatenates a matrix to the current transformation matrix (CTM). Returns TRUE on success or FALSE on failure.

bool PDF_continue_text ( resource $p , string $text ) - Prints text at the next line. Returns TRUE on success or FALSE on failure.

int PDF_create_3dview ( resource $pdfdoc , string $username , string $optlist ) - Creates a 3D view.

int PDF_create_action ( resource $pdfdoc , string $type , string $optlist ) - Creates an action which can be applied to various objects and events.

bool PDF_create_annotation ( resource $pdfdoc , float $llx , float $lly , float $urx , float $ury , string $type , string $optlist ) - Creates a rectangular annotation on the current page.

int PDF_create_bookmark ( resource $pdfdoc , string $text , string $optlist ) - Creates a bookmark subject to various options.

bool PDF_create_field ( resource $pdfdoc , float $llx , float $lly , float $urx , float $ury , string $name , string $type , string $optlist ) - Creates a form field on the current page subject to various options.

bool PDF_create_fieldgroup ( resource $pdfdoc , string $name , string $optlist ) - Creates a form field group subject to various options.

int PDF_create_gstate ( resource $pdfdoc , string $optlist ) - Creates a graphics state object subject to various options.

bool PDF_create_pvf ( resource $pdfdoc , string $filename , string $data , string $optlist ) - Creates a named virtual read-only file from data provided in memory.

int PDF_create_textflow ( resource $pdfdoc , string $text , string $optlist ) - Preprocesses text for later formatting and creates a textflow object.

bool PDF_curveto ( resource $p , float $x1 , float $y1 , float $x2 , float $y2 , float $x3 , float $y3 ) - Draws a Bezier curve from the current point, using 3 more control points. Returns TRUE on success or FALSE on failure.

int PDF_define_layer ( resource $pdfdoc , string $name , string $optlist ) - Creates a new layer definition.

bool PDF_delete ( resource $pdfdoc ) - Deletes a PDFlib object, and frees all internal resources. Returns TRUE on success or FALSE on failure.

int PDF_delete_pvf ( resource $pdfdoc , string $filename ) - Deletes a named virtual file and frees its data structures (but not the contents).

bool PDF_delete_table ( resource $pdfdoc , int $table , string $optlist ) - Deletes a table and all associated data structures.

bool PDF_delete_textflow ( resource $pdfdoc , int $textflow ) - Deletes a textflow and the associated data structures.

bool PDF_encoding_set_char ( resource $pdfdoc , string $encoding , int $slot , string $glyphname , int $uv ) - Adds a glyph name and/or Unicode value to a custom encoding.

bool PDF_end_document ( resource $pdfdoc , string $optlist ) - Closes the generated PDF file and applies various options.

bool PDF_end_font ( resource $pdfdoc ) - Terminates a Type 3 font definition.

bool PDF_end_glyph ( resource $pdfdoc ) - Terminates a glyph definition for a Type 3 font.

bool PDF_end_item ( resource $pdfdoc , int $id ) - Closes a structure element or other content item.

bool PDF_end_layer ( resource $pdfdoc ) - Deactivates all active layers. Returns TRUE on success or FALSE on failure.

bool PDF_end_page ( resource $p ) - Finishes the page. Returns TRUE on success or FALSE on failure.

bool PDF_end_page_ext ( resource $pdfdoc , string $optlist ) - Finishes a page, and applies various options. Returns TRUE on success or FALSE on failure.

bool PDF_end_pattern ( resource $p ) - Finishes the pattern definition. Returns TRUE on success or FALSE on failure.

bool PDF_end_template ( resource $p ) - Finishes a template definition. Returns TRUE on success or FALSE on failure.

bool PDF_endpath ( resource $p ) - Ends the current path without filling or stroking it.

bool PDF_fill ( resource $p ) - Fills the interior of the current path with the current fill color. Returns TRUE on success or FALSE on failure.

int PDF_fill_imageblock ( resource $pdfdoc , int $page , string $blockname , int $image , string $optlist ) - Fills an image block with variable data according to its properties.

int PDF_fill_pdfblock ( resource $pdfdoc , int $page , string $blockname , int $contents , string $optlist ) - Fills a PDF block with variable data according to its properties.

bool PDF_fill_stroke ( resource $p ) - Fills and strokes the current path with the current fill and stroke color. Returns TRUE on success or FALSE on failure.

int PDF_fill_textblock ( resource $pdfdoc , int $page , string $blockname , string $text , string $optlist ) - Fills a text block with variable data according to its properties.

int PDF_findfont ( resource $p , string $fontname , string $encoding , int $embed ) -

bool PDF_fit_image ( resource $pdfdoc , int $image , float $x , float $y , string $optlist ) - Places an image or template on the page, subject to various options. Returns TRUE on success or FALSE on failure.

bool PDF_fit_pdi_page ( resource $pdfdoc , int $page , float $x , float $y , string $optlist ) - Places an imported PDF page on the page, subject to various options. Returns TRUE on success or FALSE on failure.

string PDF_fit_table ( resource $pdfdoc , int $table , float $llx , float $lly , float $urx , float $ury , string $optlist ) - Places a table on the page fully or partially.

string PDF_fit_textflow ( resource $pdfdoc , int $textflow , float $llx , float $lly , float $urx , float $ury , string $optlist ) - Formats the next portion of a textflow into a rectangular area.

bool PDF_fit_textline ( resource $pdfdoc , string $text , float $x , float $y , string $optlist ) - Places a single line of text on the page, subject to various options. Returns TRUE on success or FALSE on failure.

string PDF_get_apiname ( resource $pdfdoc ) - Gets the name of the API function which threw the last exception or failed.

string PDF_get_buffer ( resource $p ) - Fetches the buffer containing the generated PDF data.

string PDF_get_errmsg ( resource $pdfdoc ) - Gets the text of the last thrown exception or the reason for a failed function call.

int PDF_get_errnum ( resource $pdfdoc ) - Gets the number of the last thrown exception or the reason for a failed function call.

-

-

-

-

-

int PDF_get_majorversion ( void ) -

int PDF_get_minorversion ( void ) - Returns the minor version number of the PDFlib version.

string PDF_get_parameter ( resource $p , string $key , float $modifier ) - Gets the contents of some PDFlib parameter with string type.

string PDF_get_pdi_parameter ( resource $p , string $key , int $doc , int $page , int $reserved ) - Gets the contents of a PDI document parameter with string type.

float PDF_get_pdi_value ( resource $p , string $key , int $doc , int $page , int $reserved ) - Gets the contents of a PDI document parameter with numerical type.

float PDF_get_value ( resource $p , string $key , float $modifier ) - Gets the value of some PDFlib parameter with numerical type.

float PDF_info-font ( resource $pdfdoc , int $font , string $keyword , string $optlist ) - Queries detailed information about a loaded font.

float PDF_info_matchbox ( resource $pdfdoc , string $boxname , int $num , string $keyword ) - Queries information about a matchbox on the current page.

float PDF_info_table ( resource $pdfdoc , int $table , string $keyword ) - Retrieves table information related to the most recently placed table instance.

float PDF_info_textflow ( resource $pdfdoc , int $textflow , string $keyword ) - Queries the current state of a textflow.

float PDF_info_textline ( resource $pdfdoc , string $text , string $keyword , string $optlist ) - Performs textline formatting and queries the resulting metrics.

bool PDF_initgraphics ( resource $p ) - Reset all color and graphics state parameters to their defaults. Returns TRUE on success or FALSE on failure.

bool PDF_lineto ( resource $p , float $x , float $y ) - Draws a line from the current point to another point. Returns TRUE on success or FALSE on failure.

int PDF_load_3ddata ( resource $pdfdoc , string $filename , string $optlist ) - Loads a 3D model from a disk-based or virtual file.

int PDF_load_font ( resource $pdfdoc , string $fontname , string $encoding , string $optlist ) - Searches for a font and prepares it for later use.

int PDF_load_iccprofile ( resource $pdfdoc , string $profilename , string $optlist ) - Searches for an ICC profile, and prepares it for later use.

int PDF_load_image ( resource $pdfdoc , string $imagetype , string $filename , string $optlist ) - Opens a disk-based or virtual image file subject to various options.

int PDF_makespotcolor ( resource $p , string $spotname ) - Finds a built-in spot color name, or makes a named spot color from the current fill color. Returns TRUE on success or FALSE on failure.

bool PDF_moveto ( resource $p , float $x , float $y ) - Sets the current point for graphics output. Returns TRUE on success or FALSE on failure.

resource PDF_new ( $ ) - Creates a new PDFlib object with default settings.

int PDF_open_ccitt ( resource $pdfdoc , string $filename , int $width , int $height , int $BitReverse , int $k , int $Blackls1 ) - Opens a raw CCITT image.

bool PDF_open_file ( resource $p , string $filename ) - Creates a new PDF file using the supplied file name. Returns TRUE on success or FALSE on failure.

-

int PDF_open_image ( resource $p , string $imagetype , string $source , string $data , int $length , int $width , int $height , int $components , int $bpc , string $params ) - Uses image data from a variety of data sources.

int PDF_open_image_file ( resource $p , string $imagetype , string $filename , string $stringparam , int $intparam ) - Opens an image file.

-

int PDF_open_memory_image ( resource $p , resource $image ) - This function is not supported by PDFlib GmbH.

int PDF_open_pdi ( resource $pdfdoc , string $filename , string $optlist , int $len ) - Opens a disk-based or virtual PDF document and prepares it for later use.

int PDF_open_pdi_page ( resource $p , int $doc , int $pagenumber , string $optlist ) -

-

float PDF_pcos_get_number ( resource $p , int $doc , string $path ) - Gets the value of a pCOS path with type number or boolean.

string PDF_pcos_get_stream ( resource $p , int $doc , string $optlist , string $path ) - Gets the contents of a pCOS path with type stream, fstream, or string.

string PDF_pcos_get_string ( resource $p , int $doc , string $path ) - Gets the value of a pCOS path with type name, string, or boolean.

bool PDF_place_image ( resource $pdfdoc , int $image , float $x , float $y , float $scale ) - Places an image and scales it. Returns TRUE on success or FALSE on failure.

bool PDF_place_pdi_page ( resource $pdfdoc , int $page , float $x , float $y , float $sx , float $sy ) - Places a PDF page and scales it. Returns TRUE on success or FALSE on failure.

int PDF_process_pdi ( resource $pdfdoc , int $doc , int $page , string $optlist ) - Processes certain elements of an imported PDF document.

bool PDF_rect ( resource $p , float $x , float $y , float $width , float $height ) - Draws a rectangle. Returns TRUE on success or FALSE on failure.

bool PDF_restore ( resource $p ) - Restores the most recently saved graphics state. Returns TRUE on success or FALSE on failure.

bool PDF_resume_page ( resource $pdfdoc , string $optlist ) - Resumes a page to add more content to it.

bool PDF_rotate ( resource $p , float $phi ) - Rotates the coordinate system. Returns TRUE on success or FALSE on failure.

bool PDF_save ( resource $p ) - Saves the current graphics state. Returns TRUE on success or FALSE on failure.

bool PDF_scale ( resource $p , float $sx , float $sy ) - Scales the coordinate system. Returns TRUE on success or FALSE on failure.

bool PDF_set_border_color ( resource $p , float $red , float $green , float $blue ) - Sets the border color for all kinds of annotations. Returns TRUE on success or FALSE on failure.

bool PDF_set_border_dash ( resource $pdfdoc , float $black , float $white ) - Sets the border dash style for all kinds of annotations. Returns TRUE on success or FALSE on failure.

bool PDF_set_border_style ( resource $pdfdoc , string $style , float $width ) - Sets the border style for all kinds of annotations. Returns TRUE on success or FALSE on failure.

-

-

bool PDF_set_gstate ( resource $pdfdoc , int $gstate ) - Activates a graphics state object.

-

bool PDF_set_info ( resource $p , string $key , string $value ) - Fill document information field key with value. Returns TRUE on success or FALSE on failure.

-

-

-

-

-

bool PDF_set_layer_dependency ( resource $pdfdoc , string $type , string $optlist ) - Defines hierarchical and group relationships among layers. Returns TRUE on success or FALSE on failure.

-

bool PDF_set_parameter ( resource $p , string $key , string $value ) - Sets some PDFlib parameter with string type. Returns TRUE on success or FALSE on failure.

-

bool PDF_set_text_pos ( resource $p , float $x , float $y ) - Sets the position for text output on the page. Returns TRUE on success or FALSE on failure.

-

-

bool PDF_set_value ( resource $p , string $key , float $value ) - Sets the value of some PDFlib parameter with numerical type. Returns TRUE on success or FALSE on failure.

-

bool PDF_setcolor ( resource $p , string $fstype , string $colorspace , float $c1 , float $c2 , float $c3 , float $c4 ) - Sets the current color space and color. Returns TRUE on success or FALSE on failure.

bool PDF_setdash ( resource $pdfdoc , float $b , float $w ) - Sets the current dash pattern to b black and w white units. Returns TRUE on success or FALSE on failure.

bool PDF_setdashpattern ( resource $pdfdoc , string $optlist ) - Sets a dash pattern defined by an option list. Returns TRUE on success or FALSE on failure.

bool PDF_setflat ( resource $pdfdoc , float $flatness ) - Sets the flatness parameter. Returns TRUE on success or FALSE on failure.

bool PDF_setfont ( resource $pdfdoc , int $font , float $fontsize ) -

bool PDF_setgray ( resource $p , float $g ) - Sets the current fill and stroke color to a gray value between 0 and 1 inclusive. Returns TRUE on success or FALSE on failure.

bool PDF_setgray_fill ( resource $p , float $g ) - Sets the current fill color to a gray value between 0 and 1 inclusive. Returns TRUE on success or FALSE on failure.

bool PDF_setgray_stroke ( resource $p , float $g ) - Sets the current stroke color to a gray value between 0 and 1 inclusive. Returns TRUE on success or FALSE on failure.

bool PDF_setlinecap ( resource $p , int $linecap ) - Sets the linecap parameter to control the shape at the end of a path with respect to stroking.

bool PDF_setlinejoin ( resource $p , int $value ) - Sets the linejoin parameter to specify the shape at the corners of paths that are stroked. Returns TRUE on success or FALSE on failure.

bool PDF_setlinewidth ( resource $p , float $width ) - Sets the current line width. Returns TRUE on success or FALSE on failure.

bool PDF_setmatrix ( resource $p , float $a , float $b , float $c , float $d , float $e , float $f ) - Explicitly sets the current transformation matrix. Returns TRUE on success or FALSE on failure.

bool PDF_setmiterlimit ( resource $pdfdoc , float $miter ) - Sets the miter limit.Returns TRUE on success or FALSE on failure.

-

bool PDF_setrgbcolor ( resource $p , float $red , float $green , float $blue ) - Sets the current fill and stroke color to the supplied RGB values. Returns TRUE on success or FALSE on failure.

bool PDF_setrgbcolor_fill ( resource $p , float $red , float $green , float $blue ) - Sets the current fill color to the supplied RGB values. Returns TRUE on success or FALSE on failure.

bool PDF_setrgbcolor_stroke ( resource $p , float $red , float $green , float $blue ) - Sets the current stroke color to the supplied RGB values. Returns TRUE on success or FALSE on failure.

int PDF_shading ( resource $pdfdoc , string $shtype , float $x0 , float $y0 , float $x1 , float $y1 , float $c1 , float $c2 , float $c3 , float $c4 , string $optlist ) - Defines a blend from the current fill color to another color.

int PDF_shading_pattern ( resource $pdfdoc , int $shading , string $optlist ) - Defines a shading pattern using a shading object.

bool PDF_shfill ( resource $pdfdoc , int $shading ) - Fills an area with a shading, based on a shading object.

bool PDF_show ( resource $pdfdoc , string $text ) - Prints text in the current font and size at the current position. Returns TRUE on success or FALSE on failure.

int PDF_show_boxed ( resource $p , string $text , float $left , float $top , float $width , float $height , string $mode , string $feature ) -

bool PDF_show_xy ( resource $p , string $text , float $x , float $y ) - Prints text in the current font. Returns TRUE on success or FALSE on failure.

bool PDF_skew ( resource $p , float $alpha , float $beta ) - Skews the coordinate system in x and y direction by alpha and beta degrees. Returns TRUE on success or FALSE on failure.

float PDF_stringwidth ( resource $p , string $text , int $font , float $fontsize ) - Returns the width of text in an arbitrary font.

bool PDF_stroke ( resource $p ) - Strokes the path with the current color and line width, and clear it. Returns TRUE on success or FALSE on failure.

bool PDF_suspend_page ( resource $pdfdoc , string $optlist ) -

bool PDF_translate ( resource $p , float $tx , float $ty ) - Translates the origin of the coordinate system.

string PDF_utf16_to_utf8 ( resource $pdfdoc , string $utf16string ) - Converts a string from UTF-16 format to UTF-8.

string PDF_utf32_to_utf16 ( resource $pdfdoc , string $utf32string , string $ordering ) - Converts a string from UTF-32 format to UTF-16.

string PDF_utf8_to_utf16 ( resource $pdfdoc , string $utf8string , string $ordering ) - Converts a string from UTF-8 format to UTF-16.