phpDocumentor dompdf
[ class tree: dompdf ] [ index: dompdf ] [ all elements ]

Class: CPDF_Adapter

Source Location: /include/cpdf_adapter.cls.php

Class CPDF_Adapter

Class Overview

Implements interfaces:

PDF rendering interface

CPDF_Adapter provides a simple stateless interface to the stateful one provided by the Cpdf class.

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.ros.co.nz/pdf/ for more complete documentation on the underlying Cpdf class.

Located in /include/cpdf_adapter.cls.php [line 60]



		
		
		
		

Properties

Methods

[ Top ]
Property Summary
static array;   $PAPER_SIZES   Dimensions of paper sizes in points

[ Top ]
Method Summary
CPDF_Adapter   __construct()   Class constructor
void   __destruct()   Class destructor
void   add_link()   Add a link to the pdf
void   add_named_dest()   Add a named destination (similar to <a name="foo">...</a> in html)
void   add_object()   Adds a specified 'object' to the document
void   circle()  
void   close_object()   Closes the current 'object'
void   filled_rectangle()  
Cpdf   get_cpdf()   Returns the Cpdf instance
void   get_font_height()  
float   get_height()   Returns the PDF's height in points
string   get_messages()   Returns logging messages generated by the Cpdf class
int   get_page_count()   Returns the total number of pages in the document
int   get_page_number()   Returns the current page number
void   get_text_width()  
float   get_width()   Returns the PDF's width in points
void   image()  
void   line()  
void   new_page()  
int   open_object()   Opens a new 'object'
string   output()   Returns the PDF as a string
void   page_text()   Writes text at the specified x and y coordinates on every page
void   polygon()  
void   rectangle()  
void   reopen_object()   Reopens an existing 'object'
void   set_page_count()   Sets the page count
void   set_page_number()   Sets the current page number
void   stop_object()   Stops the specified 'object' from appearing in the document.
void   stream()   Streams the PDF directly to the browser
void   text()  
float   y()   Remaps y coords from 4th to 1st quadrant
void   _add_page_text()   Add text to each page after rendering is complete
string   _convert_gif_to_png()   Convert a GIF image to a PNG image
void   _set_fill_color()   Sets the fill colour
void   _set_fill_transparency()   Sets fill transparency
void   _set_line_style()   Sets the line style
void   _set_line_transparency()   Sets line transparency
void   _set_stroke_color()   Sets the stroke colour

[ Top ]
Properties
static array;   $PAPER_SIZES = array("4a0" => array(0,0,4767.87,6740.79),"2a0"=>array(0,0,3370.39,4767.87),"a0"=>array(0,0,2383.94,3370.39),"a1"=>array(0,0,1683.78,2383.94),"a2"=>array(0,0,1190.55,1683.78),"a3"=>array(0,0,841.89,1190.55),"a4"=>array(0,0,595.28,841.89),"a5"=>array(0,0,419.53,595.28),"a6"=>array(0,0,297.64,419.53),"a7"=>array(0,0,209.76,297.64),"a8"=>array(0,0,147.40,209.76),"a9"=>array(0,0,104.88,147.40),"a10"=>array(0,0,73.70,104.88),"b0"=>array(0,0,2834.65,4008.19),"b1"=>array(0,0,2004.09,2834.65),"b2"=>array(0,0,1417.32,2004.09),"b3"=>array(0,0,1000.63,1417.32),"b4"=>array(0,0,708.66,1000.63),"b5"=>array(0,0,498.90,708.66),"b6"=>array(0,0,354.33,498.90),"b7"=>array(0,0,249.45,354.33),"b8"=>array(0,0,175.75,249.45),"b9"=>array(0,0,124.72,175.75),"b10"=>array(0,0,87.87,124.72),"c0"=>array(0,0,2599.37,3676.54),"c1"=>array(0,0,1836.85,2599.37),"c2"=>array(0,0,1298.27,1836.85),"c3"=>array(0,0,918.43,1298.27),"c4"=>array(0,0,649.13,918.43),"c5"=>array(0,0,459.21,649.13),"c6"=>array(0,0,323.15,459.21),"c7"=>array(0,0,229.61,323.15),"c8"=>array(0,0,161.57,229.61),"c9"=>array(0,0,113.39,161.57),"c10"=>array(0,0,79.37,113.39),"ra0"=>array(0,0,2437.80,3458.27),"ra1"=>array(0,0,1729.13,2437.80),"ra2"=>array(0,0,1218.90,1729.13),"ra3"=>array(0,0,864.57,1218.90),"ra4"=>array(0,0,609.45,864.57),"sra0"=>array(0,0,2551.18,3628.35),"sra1"=>array(0,0,1814.17,2551.18),"sra2"=>array(0,0,1275.59,1814.17),"sra3"=>array(0,0,907.09,1275.59),"sra4"=>array(0,0,637.80,907.09),"letter"=>array(0,0,612.00,792.00),"legal"=>array(0,0,612.00,1008.00),"ledger"=>array(0,0,1224.00,792.00),"tabloid"=>array(0,0,792.00,1224.00),"executive"=>array(0,0,521.86,756.00),"folio"=>array(0,0,612.00,936.00),"commerical #10 envelope"=>array(0,0,684,297),"catalog #10 1/2 envelope"=>array(0,0,648,864),"8.5x11"=>array(0,0,612.00,792.00),"8.5x14"=>array(0,0,612.00,1008.0),"11x17"=>array(0,0,792.00,1224.00)) [line 67]

Dimensions of paper sizes in points


[ Top ]
Methods
Constructor __construct  [line 187]

  CPDF_Adapter __construct( [mixed $paper = "letter"], [string $orientation = "portrait"]  )

Class constructor

Parameters:
mixed   $paper:  The size of paper to use in this PDF (CPDF_Adapter::$PAPER_SIZES)
string   $orientation:  The orienation of the document (either 'landscape' or 'portrait')


[ Top ]
Destructor __destruct  [line 233]

  void __destruct( )

Class destructor

Deletes all temporary image files



[ Top ]
add_link  [line 637]

  void add_link( string $url, float $x, float $y, float $width, float $height  )

Add a link to the pdf

Parameters:
string   $url:  The url to link to
float   $x:  The x position of the link
float   $y:  The y position of the link
float   $width:  The width of the link
float   $height:  The height of the link


Implementation of:
Canvas::add_link()
Add a link to the pdf

[ Top ]
add_named_dest  [line 622]

  void add_named_dest( string $anchorname  )

Add a named destination (similar to <a name="foo">...</a> in html)

Parameters:
string   $anchorname:  The name of the named destination


Implementation of:
Canvas::add_named_dest()
Add a named destination (similar to <a name="foo">...</a> in html)

[ Top ]
add_object  [line 305]

  void add_object( int $object, [string $where = 'all']  )

Adds a specified 'object' to the document

$object int specifying an object created with CPDF_Adapter::open_object(). $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

Parameters:
int   $object: 
string   $where: 

API Tags:
See:  Cpdf::addObject()


[ Top ]
circle  [line 553]

  void circle( $x, $y, $r1, $color, [ $width = null], [ $style = null], [ $fill = false], [ $blend = "Normal"], [ $opacity = 1.0]  )

Parameters:
   $x: 
   $y: 
   $r1: 
   $color: 
   $width: 
   $style: 
   $fill: 
   $blend: 
   $opacity: 


Implementation of:
Canvas::circle()
Draws a circle at $x,$y with radius $r

[ Top ]
close_object  [line 282]

  void close_object( )

Closes the current 'object'


API Tags:
See:  CPDF_Adapter::open_object()


[ Top ]
filled_rectangle  [line 520]

  void filled_rectangle( $x1, $y1, $w, $h, $color, [ $blend = "Normal"], [ $opacity = 1.0]  )

Parameters:
   $x1: 
   $y1: 
   $w: 
   $h: 
   $color: 
   $blend: 
   $opacity: 


Implementation of:
Canvas::filled_rectangle()
Draws a filled rectangle at x1,y1 with width w and height h

[ Top ]
get_cpdf  [line 244]

  Cpdf get_cpdf( )

Returns the Cpdf instance



[ Top ]
get_font_height  [line 662]

  void get_font_height( $font, $size  )

Parameters:
   $font: 
   $size: 


Implementation of:
Canvas::get_font_height()
Calculates font height, in points

[ Top ]
get_height  [line 348]

  float get_height( )

Returns the PDF's height in points



[ Top ]
get_messages  [line 771]

  string get_messages( )

Returns logging messages generated by the Cpdf class



[ Top ]
get_page_count  [line 360]

  int get_page_count( )

Returns the total number of pages in the document



Implementation of:
Canvas::get_page_count()
Returns the total number of pages

[ Top ]
get_page_number  [line 354]

  int get_page_number( )

Returns the current page number



Implementation of:
Canvas::get_page_number()
Returns the current page number

[ Top ]
get_text_width  [line 655]

  void get_text_width( $text, $font, $size, [ $spacing = 0]  )

Parameters:
   $text: 
   $font: 
   $size: 
   $spacing: 


Implementation of:
Canvas::get_text_width()
Calculates text size, in points

[ Top ]
get_width  [line 342]

  float get_width( )

Returns the PDF's width in points



[ Top ]
image  [line 571]

  void image( $img_url, $img_type, $x, $y, $w, $h  )

Parameters:
   $img_url: 
   $img_type: 
   $x: 
   $y: 
   $w: 
   $h: 


Implementation of:
Canvas::image()
Add an image to the pdf.

[ Top ]
line  [line 459]

  void line( $x1, $y1, $x2, $y2, $color, $width, [ $style = array()], [ $blend = "Normal"], [ $opacity = 1.0]  )

Parameters:
   $x1: 
   $y1: 
   $x2: 
   $y2: 
   $color: 
   $width: 
   $style: 
   $blend: 
   $opacity: 


Implementation of:
Canvas::line()
Draws a line from x1,y1 to x2,y2

[ Top ]
new_page  [line 692]

  void new_page( )



Implementation of:
Canvas::new_page()
Starts a new page

[ Top ]
open_object  [line 260]

  int open_object( )

Opens a new 'object'

While an object is open, all drawing actions are recored in the object, as opposed to 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.


API Tags:
See:  CPDF_Adapter::add_object()
See:  CPDF_Adapter::close_object()


[ Top ]
output  [line 751]

  string output( [ $options = null]  )

Returns the PDF as a string

Parameters:
   $options: 


Implementation of:
Canvas::output()
Returns the PDF as a string

[ Top ]
page_text  [line 684]

  void page_text( float $x, float $y, string $text, string $font, float $size, [array $color = array(0,0,0)], [float $adjust = 0], [float $angle = 0], [ $blend = "Normal"], [ $opacity = 1.0]  )

Writes text at the specified x and y coordinates on every page

The strings '{PAGE_NUM}' and '{PAGE_COUNT}' are automatically replaced with their current values.

See Style::munge_colour() for the format of the colour array.

Parameters:
float   $x: 
float   $y: 
string   $text:  the text to write
string   $font:  the font file to use
float   $size:  the font size, in points
array   $color: 
float   $adjust:  word spacing adjustment
float   $angle:  angle to write the text at, measured CW starting from the x-axis
   $blend: 
   $opacity: 


[ Top ]
polygon  [line 532]

  void polygon( $points, $color, [ $width = null], [ $style = array()], [ $fill = false], [ $blend = "Normal"], [ $opacity = 1.0]  )

Parameters:
   $points: 
   $color: 
   $width: 
   $style: 
   $fill: 
   $blend: 
   $opacity: 


Implementation of:
Canvas::polygon()
Draws a polygon

[ Top ]
rectangle  [line 508]

  void rectangle( $x1, $y1, $w, $h, $color, $width, [ $style = array()], [ $blend = "Normal"], [ $opacity = 1.0]  )

Parameters:
   $x1: 
   $y1: 
   $w: 
   $h: 
   $color: 
   $width: 
   $style: 
   $blend: 
   $opacity: 


Implementation of:
Canvas::rectangle()
Draws a rectangle at x1,y1 with width w and height h

[ Top ]
reopen_object  [line 272]

  void reopen_object( int $object  )

Reopens an existing 'object'

Parameters:
int   $object:  the ID of a previously opened object

API Tags:
See:  CPDF_Adapter::open_object()


[ Top ]
set_page_count  [line 374]

  void set_page_count( int $count  )

Sets the page count

Parameters:
int   $count: 


Implementation of:
Canvas::set_page_count()
Sets the total number of pages

[ Top ]
set_page_number  [line 367]

  void set_page_number( int $num  )

Sets the current page number

Parameters:
int   $num: 


[ Top ]
stop_object  [line 317]

  void stop_object( int $object  )

Stops the specified 'object' from appearing in the document.

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

Parameters:
int   $object: 


[ Top ]
stream  [line 736]

  void stream( string $filename, [array $options = null]  )

Streams the PDF directly to the browser

Parameters:
string   $filename:  the name of the PDF file
array   $options:  associative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0


Implementation of:
Canvas::stream()
Streams the PDF directly to the browser

[ Top ]
text  [line 600]

  void text( $x, $y, $text, $font, $size, [ $color = array(0,0,0)], [ $adjust = 0], [ $angle = 0], [ $blend = "Normal"], [ $opacity = 1.0]  )

Parameters:
   $x: 
   $y: 
   $text: 
   $font: 
   $size: 
   $color: 
   $adjust: 
   $angle: 
   $blend: 
   $opacity: 


Implementation of:
Canvas::text()
Writes text at the specified x and y coordinates

[ Top ]
y  [line 455]

  float y( float $y  )

Remaps y coords from 4th to 1st quadrant

Parameters:
float   $y: 

API Tags:
Access:  protected


[ Top ]
_add_page_text  [line 705]

  void _add_page_text( )

Add text to each page after rendering is complete


API Tags:
Access:  protected


[ Top ]
_convert_gif_to_png  [line 478]

  string _convert_gif_to_png( $image_url  )

Convert a GIF image to a PNG image

Parameters:
   $image_url: 

API Tags:
Return:  The url of the newly converted image
Access:  protected


[ Top ]
_set_fill_color  [line 393]

  void _set_fill_color( array $color  )

Sets the fill colour

See Style::set_colour() for the format of the colour array.

Parameters:
array   $color: 

API Tags:
Access:  protected


[ Top ]
_set_fill_transparency  [line 428]

  void _set_fill_transparency( string $mode, float $opacity  )

Sets fill transparency

Parameters:
string   $mode:  the blending mode to use
float   $opacity:  0.0 fully transparent, 1.0 fully opaque

API Tags:
See:  Cpdf::setFillTransparency() Valid blend modes are (case-sensitive): Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDogde, ColorBurn, HardLight, SoftLight, Difference, Exclusion
Access:  protected


[ Top ]
_set_line_style  [line 442]

  void _set_line_style( float $width, string $cap, string $join, array $dash  )

Sets the line style

Parameters:
float   $width:  width
string   $cap:  cap
string   $join:  join
array   $dash:  dash

API Tags:
See:  Cpdf::setLineStyle()
Access:  protected


[ Top ]
_set_line_transparency  [line 411]

  void _set_line_transparency( string $mode, float $opacity  )

Sets line transparency

Parameters:
string   $mode:  the blending mode to use
float   $opacity:  0.0 fully transparent, 1.0 fully opaque

API Tags:
See:  Cpdf::setLineTransparency() Valid blend modes are (case-sensitive): Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn, HardLight, SoftLight, Difference, Exclusion
Access:  protected


[ Top ]
_set_stroke_color  [line 382]

  void _set_stroke_color( array $color  )

Sets the stroke colour

See Style::set_colour() for the format of the color array.

Parameters:
array   $color: 

API Tags:
Access:  protected


[ Top ]

Documentation generated on Mon, 09 Nov 2009 19:24:41 -0800 by phpDocumentor 1.4.3