Before using pdflib make sure to check what version of php u have coz there’s a difference how the function are being called between these versions.
You might get one of these error if you have php5 and using the php4 code for it
Error: error for php5 pdf_begin_document not working
In PHP 4, first a PDF resource has to be retrieved with a function call like
$p = PDF_new().
This PDF resource is used as the first parameter in all further function calls, such as in
PDF_begin_document($p, “”, “”).
In PHP 5 however, a PDFlib object is created with
$p = new PDFlib().
This object offers all PDFlib API functions as methods, e.g. as with
$p->begin_document(“”, “”).
Pasted below are examples between the php4 and php5.
Example 1. Hello World example from PDFlib distribution for PHP 4
<?php |
The following example comes with the PDFlib distribution for PHP 5. It uses the new exception handling and object encapsulation features available in PHP 5. It creates the file hello.pdf with one page. It defines some document info field contents, loads the Helvetica-Bold font and outputs the text “Hello world! (says PHP)”.
Example 2. Hello World example from PDFlib distribution for PHP 5
<?php
|
Functions
- Table of Contents
- PDF_activate_item –Â Activate structure element or other content item
- PDF_add_annotation –Â Add annotation [deprecated]
- PDF_add_bookmark –Â Add bookmark for current page [deprecated]
- PDF_add_launchlink –Â Add launch annotation for current page [deprecated]
- PDF_add_locallink –Â Add link annotation for current page [deprecated]
- PDF_add_nameddest –Â Create named destination
- PDF_add_note –Â Set annotation for current page [deprecated]
- PDF_add_outline –Â Add bookmark for current page [deprecated]
- PDF_add_pdflink –Â Add file link annotation for current page [deprecated]
- PDF_add_thumbnail –Â Add thumbnail for current page
- PDF_add_weblink –Â Add weblink for current page [deprecated]
- PDF_arc –Â Draw a counterclockwise circular arc segment
- PDF_arcn –Â Draw a clockwise circular arc segment
- PDF_attach_file –Â Add file attachment for current page [deprecated]
- PDF_begin_document –Â Create new PDF file
- PDF_begin_font –Â Start a Type 3 font definition
- PDF_begin_glyph –Â Start glyph definition for Type 3 font
- PDF_begin_item –Â Open structure element or other content item
- PDF_begin_layer –Â Start layer
- PDF_begin_page_ext –Â Start new page
- PDF_begin_page –Â Start new page [deprecated]
- PDF_begin_pattern –Â Start pattern definition
- PDF_begin_template –Â Start template definition
- PDF_circle –Â Draw a circle
- PDF_clip –Â Clip to current path
- PDF_close_image –Â Close image
- PDF_close_pdi_page –Â Close the page handle
- PDF_close_pdi –Â Close the input PDF document
- PDF_close –Â Close pdf resource [deprecated]
- PDF_closepath_fill_stroke –Â Close, fill and stroke current path
- PDF_closepath_stroke –Â Close and stroke path
- PDF_closepath –Â Close current path
- PDF_concat –Â Concatenate a matrix to the CTM
- PDF_continue_text –Â Output text in next line
- PDF_create_action –Â Create action for objects or events
- PDF_create_annotation –Â Create rectangular annotation
- PDF_create_bookmark –Â Create bookmark
- PDF_create_field –Â Create form field
- PDF_create_fieldgroup –Â Create form field group
- PDF_create_gstate –Â Create graphics state object
- PDF_create_pvf –Â Create PDFlib virtual file
- PDF_create_textflow –Â Create textflow object
- PDF_curveto –Â Draw Bezier curve
- PDF_define_layer –Â Create layer definition
- PDF_delete_pvf –Â Delete PDFlib virtual file
- PDF_delete_textflow –Â Delete textflow object
- PDF_delete –Â Delete PDFlib object
- PDF_encoding_set_char –Â Add glyph name and/or Unicode value
- PDF_end_document –Â Close PDF file
- PDF_end_font –Â Terminate Type 3 font definition
- PDF_end_glyph –Â Terminate glyph definition for Type 3 font
- PDF_end_item –Â Close structure element or other content item
- PDF_end_layer –Â Deactivate all active layers
- PDF_end_page_ext –Â Finish page
- PDF_end_page –Â Finish page
- PDF_end_pattern –Â Finish pattern
- PDF_end_template –Â Finish template
- PDF_endpath –Â End current path
- PDF_fill_imageblock –Â Fill image block with variable data
- PDF_fill_pdfblock –Â Fill PDF block with variable data
- PDF_fill_stroke –Â Fill and stroke path
- PDF_fill_textblock –Â Fill text block with variable data
- PDF_fill –Â Fill current path
- PDF_findfont –Â Prepare font for later use [deprecated]
- PDF_fit_image –Â Place image or template
- PDF_fit_pdi_page –Â Place imported PDF page
- PDF_fit_textflow –Â Format textflow in rectangular area
- PDF_fit_textline –Â Place single line of text
- PDF_get_apiname –Â Get name of unsuccessfull API function
- PDF_get_buffer –Â Get PDF output buffer
- PDF_get_errmsg –Â Get error text
- PDF_get_errnum –Â Get error number
- PDF_get_font –Â Get font [deprecated]
- PDF_get_fontname –Â Get font name [deprecated]
- PDF_get_fontsize –Â Font handling [deprecated]
- PDF_get_image_height –Â Get image height [deprecated]
- PDF_get_image_width –Â Get image width [deprecated]
- PDF_get_majorversion –Â Get major version number [deprecated]
- PDF_get_minorversion –Â Get minor version number [deprecated]
- PDF_get_parameter –Â Get string parameter
- PDF_get_pdi_parameter –Â Get PDI string parameter
- PDF_get_pdi_value –Â Get PDI numerical parameter
- PDF_get_value –Â Get numerical parameter
- PDF_info_textflow –Â Query textflow state
- PDF_initgraphics –Â Reset graphic state
- PDF_lineto –Â Draw a line
- PDF_load_font –Â Search and prepare font
- PDF_load_iccprofile –Â Search and prepare ICC profile
- PDF_load_image –Â Open image file
- PDF_makespotcolor –Â Make spot color
- PDF_moveto –Â Set current point
- PDF_new –Â Create PDFlib object
- PDF_open_ccitt –Â Open raw CCITT image [deprecated]
- PDF_open_file –Â Create PDF file [deprecated]
- PDF_open_gif –Â Open GIF image [deprecated]
- PDF_open_image_file –Â Read image from file [deprecated]
- PDF_open_image –Â Use image data [deprecated]
- PDF_open_jpeg –Â Open JPEG image [deprecated]
- PDF_open_memory_image –Â Open image created with PHP’s image functions [not supported]
- PDF_open_pdi_page –Â Prepare a page
- PDF_open_pdi –Â Open PDF file
- PDF_open_tiff –Â Open TIFF image [deprecated]
- PDF_place_image –Â Place image on the page [deprecated]
- PDF_place_pdi_page –Â Place PDF page [deprecated]
- PDF_process_pdi –Â Process imported PDF document
- PDF_rect –Â Draw rectangle
- PDF_restore –Â Restore graphics state
- PDF_resume_page –Â Resume page
- PDF_rotate –Â Rotate coordinate system
- PDF_save –Â Save graphics state
- PDF_scale –Â Scale coordinate system
- PDF_set_border_color –Â Set border color of annotations [deprecated]
- PDF_set_border_dash –Â Set border dash style of annotations [deprecated]
- PDF_set_border_style –Â Set border style of annotations [deprecated]
- PDF_set_char_spacing –Â Set character spacing [deprecated]
- PDF_set_duration –Â Set duration between pages [deprecated]
- PDF_set_gstate –Â Activate graphics state object
- PDF_set_horiz_scaling –Â Set horizontal text scaling [deprecated]
- PDF_set_info_author –Â Fill the author document info field [deprecated]
- PDF_set_info_creator –Â Fill the creator document info field [deprecated]
- PDF_set_info_keywords –Â Fill the keywords document info field [deprecated]
- PDF_set_info_subject –Â Fill the subject document info field [deprecated]
- PDF_set_info_title –Â Fill the title document info field [deprecated]
- PDF_set_info –Â Fill document info field
- PDF_set_layer_dependency –Â Define relationships among layers
- PDF_set_leading –Â Set distance between text lines [deprecated]
- PDF_set_parameter –Â Set string parameter
- PDF_set_text_matrix –Â Set text matrix [deprecated]
- PDF_set_text_pos –Â Set text position
- PDF_set_text_rendering –Â Determine text rendering [deprecated]
- PDF_set_text_rise –Â Set text rise [deprecated]
- PDF_set_value –Â Set numerical parameter
- PDF_set_word_spacing –Â Set spacing between words [deprecated]
- PDF_setcolor –Â Set fill and stroke color
- PDF_setdash –Â Set simple dash pattern
- PDF_setdashpattern –Â Set dash pattern
- PDF_setflat –Â Set flatness
- PDF_setfont –Â Set font
- PDF_setgray_fill –Â Set fill color to gray [deprecated]
- PDF_setgray_stroke –Â Set stroke color to gray [deprecated]
- PDF_setgray –Â Set color to gray [deprecated]
- PDF_setlinecap –Â Set linecap parameter
- PDF_setlinejoin –Â Set linejoin parameter
- PDF_setlinewidth –Â Set line width
- PDF_setmatrix –Â Set current transformation matrix
- PDF_setmiterlimit –Â Set miter limit
- PDF_setpolydash –Â Set complicated dash pattern [deprecated]
- PDF_setrgbcolor_fill –Â Set fill rgb color values [deprecated]
- PDF_setrgbcolor_stroke –Â Set stroke rgb color values [deprecated]
- PDF_setrgbcolor –Â Set fill and stroke rgb color values [deprecated]
- PDF_shading_pattern –Â Define shading pattern
- PDF_shading –Â Define blend
- PDF_shfill –Â Fill area with shading
- PDF_show_boxed –Â Output text in a box [deprecated]
- PDF_show_xy –Â Output text at given position
- PDF_show –Â Output text at current position
- PDF_skew –Â Skew the coordinate system
- PDF_stringwidth –Â Return width of text
- PDF_stroke –Â Stroke path
- PDF_suspend_page –Â Suspend page
- PDF_translate –Â Set origin of coordinate system
- PDF_utf16_to_utf8 –Â Convert string from UTF-16 to UTF-8
- PDF_utf8_to_utf16 –Â Convert string from UTF-8 to UTF-16
How can I make sure what version of php used a php form?