Class PDFLib_Adapter

Description

Implements interfaces:

PDF rendering interface

PDFLib_Adapter provides a simple, stateless interface to the one provided by PDFLib.

Unless otherwise mentioned, all dimensions are in points (1/72 in). The coordinate origin is in the top left corner and y values increase downwards.

See http://www.pdflib.com/ for more complete documentation on the underlying PDFlib class.

Located in /include/pdflib_adapter.cls.php (line 57)


	
			
Class Constant Summary
Variable Summary
bool $IN_MEMORY
array; $PAPER_SIZES
Method Summary
PDFLib_Adapter __construct ([string $paper = "letter"], [string $orientation = "portrait"])
void add_object (int $object, [string $where = 'all'])
void circle (mixed $x, mixed $y, mixed $r, mixed $color, [mixed $width = null], [mixed $style = null], [mixed $fill = false])
void close_object ()
void filled_rectangle (mixed $x1, mixed $y1, mixed $w, mixed $h, mixed $color)
void get_font_height (mixed $font, mixed $size)
void get_height ()
void get_page_count ()
void get_page_number ()
PDFLib get_pdflib ()
void get_text_width (mixed $text, mixed $font, mixed $size, mixed $spacing)
void get_width ()
void image (mixed $img_url, mixed $img_type, mixed $x, mixed $y, mixed $w, mixed $h)
void line (mixed $x1, mixed $y1, mixed $x2, mixed $y2, mixed $color, mixed $width, [mixed $style = null])
void new_page ()
int open_object ()
void output ()
void page_text (mixed $x, mixed $y, mixed $text, mixed $font, mixed $size, [mixed $color = array(0,0,0)], mixed $adjust, mixed $angle, [mixed $blend = "Normal"], [mixed $opacity = 1.0])
void polygon (mixed $points, mixed $color, [mixed $width = null], [mixed $style = null], [mixed $fill = false])
void rectangle (mixed $x1, mixed $y1, mixed $w, mixed $h, mixed $color, mixed $width, [mixed $style = null])
void reopen_object (int $object)
void set_page_count (mixed $count)
void set_page_number (mixed $num)
void stop_object (int $object)
void stream (mixed $filename, [mixed $options = null])
void text (mixed $x, mixed $y, mixed $text, mixed $font, mixed $size, [mixed $color = array(0,0,0)], mixed $adjust, mixed $angle)
void _close ()
int _load_font (string $font, [mixed $encoding = "auto"], [mixed $options = ""])
void _place_objects ()
void _set_fill_color (array $color)
void _set_line_style (float $width, string $cap, string $join, array $dash)
void _set_stroke_color (array $color)
Variables
bool $IN_MEMORY = true (line 82)

Whether to create PDFs in memory or on disk

  • static:
array; $PAPER_SIZES = array() (line 64)

Dimensions of paper sizes in points

  • access: public
  • static:
Methods
Constructor __construct (line 160)

Class constructor

PDFLib_Adapter __construct ([string $paper = "letter"], [string $orientation = "portrait"])
  • string $paper: The size of paper to use (PDFLib_Adapter::$PAPER_SIZES)
  • string $orientation: The orientation of the document (either 'landscape' or 'portrait')
add_object (line 309)

Adds the specified object to the document

$where can be one of:

  • 'add' add to current page only
  • 'all' add to every page from the current one onwards
  • 'odd' add to all odd numbered pages from now on
  • 'even' add to all even numbered pages from now on
  • 'next' add the object to the next page only
  • 'nextodd' add to all odd numbered pages from the next one
  • 'nexteven' add to all even numbered pages from the next one

void add_object (int $object, [string $where = 'all'])
  • int $object: the object handle returned by open_object()
  • string $where
circle (line 544)
void circle (mixed $x, mixed $y, mixed $r, mixed $color, [mixed $width = null], [mixed $style = null], [mixed $fill = false])
close_object (line 288)

Close the current template

void close_object ()
filled_rectangle (line 510)
void filled_rectangle (mixed $x1, mixed $y1, mixed $w, mixed $h, mixed $color)
get_font_height (line 610)
void get_font_height (mixed $font, mixed $size)
get_height (line 366)
void get_height ()
get_page_count (line 370)
void get_page_count ()
get_page_number (line 368)
void get_page_number ()
get_pdflib (line 248)

Returns the PDFLib instance

PDFLib get_pdflib ()
get_text_width (line 598)
void get_text_width (mixed $text, mixed $font, mixed $size, mixed $spacing)
get_width (line 364)
void get_width ()
image (line 563)
void image (mixed $img_url, mixed $img_type, mixed $x, mixed $y, mixed $w, mixed $h)
line (line 489)
void line (mixed $x1, mixed $y1, mixed $x2, mixed $y2, mixed $color, mixed $width, [mixed $style = null])
new_page (line 636)
void new_page ()
open_object (line 264)

Opens a new 'object' (template in PDFLib-speak)

While an object is open, all drawing actions are recorded to the object instead of being drawn on the current page. Objects can be added later to a specific page or to several pages.

The return value is an integer ID for the new object.

int open_object ()
output (line 700)
void output ()
page_text (line 624)
void page_text (mixed $x, mixed $y, mixed $text, mixed $font, mixed $size, [mixed $color = array(0,0,0)], mixed $adjust, mixed $angle, [mixed $blend = "Normal"], [mixed $opacity = 1.0])
polygon (line 518)
void polygon (mixed $points, mixed $color, [mixed $width = null], [mixed $style = null], [mixed $fill = false])
rectangle (line 500)
void rectangle (mixed $x1, mixed $y1, mixed $w, mixed $h, mixed $color, mixed $width, [mixed $style = null])
reopen_object (line 279)

Reopen an existing object (NOT IMPLEMENTED)

PDFLib does not seem to support reopening templates.

void reopen_object (int $object)
  • int $object: the ID of a previously opened object
set_page_count (line 374)
void set_page_count (mixed $count)
set_page_number (line 372)
void set_page_number (mixed $num)
stop_object (line 329)

Stops the specified template from appearing in the document.

The object will stop being displayed on the page following the current one.

void stop_object (int $object)
  • int $object
stream (line 656)
void stream (mixed $filename, [mixed $options = null])
text (line 581)
void text (mixed $x, mixed $y, mixed $text, mixed $font, mixed $size, [mixed $color = array(0,0,0)], mixed $adjust, mixed $angle)
_close (line 228)

Close the pdf

  • access: protected
void _close ()
_load_font (line 459)

Loads a specific font and stores the corresponding descriptor.

  • return: the font descriptor for the font
  • access: protected
int _load_font (string $font, [mixed $encoding = "auto"], [mixed $options = ""])
  • string $font
_place_objects (line 347)

Add all active objects to the current page

  • access: protected
void _place_objects ()
_set_fill_color (line 448)

Sets the fill color

  • access: protected
void _set_fill_color (array $color)
  • array $color: array(r,g,b)
_set_line_style (line 385)

Sets the line style

  • access: protected
void _set_line_style (float $width, string $cap, string $join, array $dash)
  • float $width: width
  • string $cap: corner
  • string $join: join
  • array $dash: dash
_set_stroke_color (line 438)

Sets the line color

  • access: protected
void _set_stroke_color (array $color)
  • array $color: array(r,g,b)
Class Constants
FONT_HEIGHT_SCALE = 1.2 (line 75)

Fudge factor to adjust reported font heights

CPDF reports larger font heights than PDFLib. This factor adjusts the height reported by get_font_height().

Documentation generated on Fri, 04 Mar 2005 13:31:19 -0700 by phpDocumentor 1.3.0RC3