MIOLO26
Carregando...
Procurando...
Nenhuma entrada encontrada
Referência à classe PDFLib_Adapter
Diagrama de heranças da classe PDFLib_Adapter
Canvas

Membros públicos

 __construct ($paper="letter", $orientation="portrait")
 
 get_pdflib ()
 
 open_object ()
 
 reopen_object ($object)
 
 close_object ()
 
 add_object ($object, $where='all')
 
 stop_object ($object)
 
 get_width ()
 
 get_height ()
 
 get_page_number ()
 
 get_page_count ()
 
 set_page_number ($num)
 
 set_page_count ($count)
 
 line ($x1, $y1, $x2, $y2, $color, $width, $style=null)
 
 rectangle ($x1, $y1, $w, $h, $color, $width, $style=null)
 
 filled_rectangle ($x1, $y1, $w, $h, $color)
 
 polygon ($points, $color, $width=null, $style=null, $fill=false)
 
 circle ($x, $y, $r, $color, $width=null, $style=null, $fill=false)
 
 image ($img_url, $img_type, $x, $y, $w, $h)
 
 text ($x, $y, $text, $font, $size, $color=array(0, 0, 0), $adjust=0, $angle=0)
 
 add_named_dest ($anchorname)
 
 add_link ($url, $x, $y, $width, $height)
 
 get_text_width ($text, $font, $size, $spacing=0)
 
 get_font_height ($font, $size)
 
 page_text ($x, $y, $text, $font, $size, $color=array(0, 0, 0), $adjust=0, $angle=0, $blend="Normal", $opacity=1.0)
 
 new_page ()
 
 stream ($filename, $options=null)
 
 output ($options=null)
 
- Membros públicos herdados de Canvas
 text ($x, $y, $text, $font, $size, $color=array(0, 0, 0), $adjust=0)
 

Campos de Dados

const FONT_HEIGHT_SCALE = 1.2
 

Atributos Públicos Estáticos

static $PAPER_SIZES = array()
 
static $IN_MEMORY = true
 

Membros protegidos

 _close ()
 
 _place_objects ()
 
 _set_line_style ($width, $cap, $join, $dash)
 
 _set_stroke_color ($color)
 
 _set_fill_color ($color)
 
 _load_font ($font, $encoding=null, $options="")
 
 y ($y)
 
 _add_page_text ()
 

Documentação dos Construtores & Destrutor

◆ __construct()

__construct ( $paper = "letter",
$orientation = "portrait" )

Class constructor

Parâmetros
mixed$paperThe size of paper to use either a string (see CPDF_Adapter::$PAPER_SIZES) or an array(xmin,ymin,xmax,ymax)
string$orientationThe orientation of the document (either 'landscape' or 'portrait')

Documentação das funções

◆ _add_page_text()

_add_page_text ( )
protected

Add text to each page after rendering is complete

◆ _close()

_close ( )
protected

Close the pdf

◆ _load_font()

_load_font ( $font,
$encoding = null,
$options = "" )
protected

Loads a specific font and stores the corresponding descriptor.

Parâmetros
string$font
Retorna
int the font descriptor for the font

◆ _place_objects()

_place_objects ( )
protected

Add all active objects to the current page

◆ _set_fill_color()

_set_fill_color ( $color)
protected

Sets the fill color

Parâmetros
array$colorarray(r,g,b)

◆ _set_line_style()

_set_line_style ( $width,
$cap,
$join,
$dash )
protected

Sets the line style

Parâmetros
floatwidth
stringcorner
stringjoin
arraydash

◆ _set_stroke_color()

_set_stroke_color ( $color)
protected

Sets the line color

Parâmetros
array$colorarray(r,g,b)

◆ add_link()

add_link ( $url,
$x,
$y,
$width,
$height )

Add a link to the pdf

Parâmetros
string$urlThe url to link to
float$xThe x position of the link
float$yThe y position of the link
float$widthThe width of the link
float$heightThe height of the link

Implementa Canvas.

◆ add_named_dest()

add_named_dest ( $anchorname)

Add a named destination (similar to ... in html)

Parâmetros
string$anchornameThe name of the named destination

Implementa Canvas.

◆ add_object()

add_object ( $object,
$where = 'all' )

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
Parâmetros
int$objectthe object handle returned by open_object()
string$where

◆ circle()

circle ( $x,
$y,
$r,
$color,
$width = null,
$style = null,
$fill = false )

Draws a circle at $x,$y with radius $r

See Style::munge_colour() for the format of the colour array. See Cpdf::setLineStyle() for a description of the $style parameter (aka dash)

Parâmetros
float$x
float$y
float$r
array$color
float$width
array$style
bool$fillFills the circle if true

Implementa Canvas.

◆ close_object()

close_object ( )

Close the current template

Veja também
PDFLib_Adapter::open_object()

◆ filled_rectangle()

filled_rectangle ( $x1,
$y1,
$w,
$h,
$color )

Draws a filled rectangle at x1,y1 with width w and height h

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

Parâmetros
float$x1
float$y1
float$w
float$h
array$color

Implementa Canvas.

◆ get_font_height()

get_font_height ( $font,
$size )

Calculates font height, in points

Parâmetros
string$font
float$size
Retorna
float

Implementa Canvas.

◆ get_height()

get_height ( )

◆ get_page_count()

get_page_count ( )

Returns the total number of pages

Retorna
int

Implementa Canvas.

◆ get_page_number()

get_page_number ( )

Returns the current page number

Retorna
int

Implementa Canvas.

◆ get_pdflib()

get_pdflib ( )

Returns the PDFLib instance

Retorna
PDFLib

◆ get_text_width()

get_text_width ( $text,
$font,
$size,
$spacing = 0 )

Calculates text size, in points

Parâmetros
string$textthe text to be sized
string$fontthe desired font
float$sizethe desired font size
float$spacingword spacing, if any
Retorna
float

Implementa Canvas.

◆ get_width()

get_width ( )

◆ image()

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

Add an image to the pdf.

The image is placed at the specified x and y coordinates with the given width and height.

Parâmetros
string$img_urlthe path to the image
string$img_typethe type (e.g. extension) of the image
float$xx position
float$yy position
int$wwidth (in pixels)
int$hheight (in pixels)

Implementa Canvas.

◆ line()

line ( $x1,
$y1,
$x2,
$y2,
$color,
$width,
$style = null )

Draws a line from x1,y1 to x2,y2

See Style::munge_colour() for the format of the colour array. See Cpdf::setLineStyle() for a description of the format of the $style parameter (aka dash).

Parâmetros
float$x1
float$y1
float$x2
float$y2
array$color
float$width
array$style

Implementa Canvas.

◆ new_page()

new_page ( )

Starts a new page

Subsequent drawing operations will appear on the new page.

Implementa Canvas.

◆ open_object()

open_object ( )

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.

Veja também
PDFLib_Adapter::close_object()
PDFLib_Adapter::add_object()
Retorna
int

◆ output()

output ( $options = null)

Returns the PDF as a string

Parâmetros
array$optionsassociative array: 'compress' => 1 or 0
Retorna
string

Implementa Canvas.

◆ page_text()

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

◆ polygon()

polygon ( $points,
$color,
$width = null,
$style = null,
$fill = false )

Draws a polygon

The polygon is formed by joining all the points stored in the $points array. $points has the following structure: array(0 => x1, 1 => y1, 2 => x2, 3 => y2, ... );

See Style::munge_colour() for the format of the colour array. See Cpdf::setLineStyle() for a description of the $style parameter (aka dash)

Parâmetros
array$points
array$color
float$width
array$style
bool$fillFills the polygon if true

Implementa Canvas.

◆ rectangle()

rectangle ( $x1,
$y1,
$w,
$h,
$color,
$width,
$style = null )

Draws a rectangle at x1,y1 with width w and height h

See Style::munge_colour() for the format of the colour array. See Cpdf::setLineStyle() for a description of the $style parameter (aka dash)

Parâmetros
float$x1
float$y1
float$w
float$h
array$color
float$width
array$style

Implementa Canvas.

◆ reopen_object()

reopen_object ( $object)

Reopen an existing object (NOT IMPLEMENTED)

PDFLib does not seem to support reopening templates.

Parâmetros
int$objectthe ID of a previously opened object

◆ set_page_count()

set_page_count ( $count)

Sets the total number of pages

Parâmetros
int$count

Implementa Canvas.

◆ set_page_number()

set_page_number ( $num)

◆ stop_object()

stop_object ( $object)

Stops the specified template from appearing in the document.

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

Parâmetros
int$object

◆ stream()

stream ( $filename,
$options = null )

Streams the PDF directly to the browser

Parâmetros
string$filenamethe name of the PDF file
array$optionsassociative array, 'Attachment' => 0 or 1, 'compress' => 1 or 0

Implementa Canvas.

◆ text()

text ( $x,
$y,
$text,
$font,
$size,
$color = array(0,0,0),
$adjust = 0,
$angle = 0 )

◆ y()

y ( $y)
protected

Remaps y coords from 4th to 1st quadrant

Parâmetros
float$y
Retorna
float

Documentação dos campos e atributos

◆ $IN_MEMORY

$IN_MEMORY = true
static

◆ $PAPER_SIZES

$PAPER_SIZES = array()
static

◆ FONT_HEIGHT_SCALE

const FONT_HEIGHT_SCALE = 1.2

A documentação para esta classe foi gerada a partir do seguinte ficheiro: