[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Image/Canvas/ -> PDF.php (sommaire)

Class for handling output in PDF format. Requires PHP extension PDFlib

Author: Jesper Veggerby <pear.nosey@veggerby.dk>
Copyright: Copyright (C) 2003, 2004 Jesper Veggerby Hansen
License: http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
Version: CVS: $Id: PDF.php,v 1.5 2005/10/28 09:54:40 nosey Exp $
Poids: 1007 lignes (32 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 2 fichiers
 Image/Canvas.php
 Image/Canvas/Color.php

Définit 1 class

Image_Canvas_PDF:: (24 méthodes):
  Image_Canvas_PDF()
  _getX()
  _getY()
  _color()
  _setLineStyle()
  _setFillStyle()
  _setFont()
  setFillImage()
  setGradientFill()
  setFont()
  _reset()
  line()
  polygon()
  rectangle()
  ellipse()
  pieslice()
  textWidth()
  textHeight()
  addText()
  image()
  show()
  save()
  toHtml()
  _version()


Classe: Image_Canvas_PDF  - X-Ref

PDF Canvas class.

Image_Canvas_PDF($param)   X-Ref
Create the PDF canvas.

Parameters available:

'page' Specify the page/paper format for the graph's page, available
formats are: A0, A1, A2, A3, A4, A5, A6, B5, letter, legal, ledger,
11x17, cd_front, inlay, inlay_nosides

'align' Alignment of the graph on the page, available options are:
topleft, topcenter, topright, leftcenter, center, rightcenter,
leftbottom, centerbottom, rightbottom

'orientation' Specifies the paper orientation, default is 'portrait' and
'landscape' is also supported.

'creator' The creator tag of the PDF/graph

'author' The author tag of the PDF/graph

'title' The title tag of the PDF/graph

'width' The width of the graph on the page

'height' The height of the graph on the page

'left' The left offset of the graph on the page

'top' The top offset of the graph on the page

'filename' The PDF file to open/add page to, using 'filename' requires
the commercial version of PDFlib (http://www.pdflib.com/), this has for
obvious ($ 450) reasons not been tested

'pdf' An existing PDFlib PDF document to add the page to

'add_page' (true/false) Used together with 'pdf', to specify whether the
canvas should add a new graph page (true) or create the graph on the
current page (false), default is 'true'

The 'page' and 'width' & 'height' can be mutually omitted, if 'page' is
omitted the page is created using dimensions of width x height, and if
width and height are omitted the page dimensions are used for the graph.

If 'pdf' is specified, 'filename', 'creator', 'author' and 'title' has no
effect.

'left' and 'top' are overridden by 'align'

It is required either to specify 'width' & 'height' or 'page'.

The PDF format/PDFlib has some limitations on the capabilities, which
means some functionality available using other canvass (fx. alpha
blending and gradient fills) are not supported with PDF (see Canvas.txt
in the docs/ folder for further details)

param: array $param Parameter array

_getX($x)   X-Ref
Get the x-point from the relative to absolute coordinates

param: float $x The relative x-coordinate (in percentage of total width)
return: float The x-coordinate as applied to the canvas

_getY($y)   X-Ref
Get the y-point from the relative to absolute coordinates

param: float $y The relative y-coordinate (in percentage of total width)
return: float The y-coordinate as applied to the canvas

_color($color = false)   X-Ref
Get the color index for the RGB color

param: int $color The color
return: int The GD image index of the color

_setLineStyle($lineStyle = false)   X-Ref
Get the PDF linestyle

param: mixed $lineStyle The line style to return, false if the one
return: bool True if set (so that a line should be drawn)

_setFillStyle($fillStyle = false)   X-Ref
Set the PDF fill style

param: mixed $fillStyle The fillstyle to return, false if the one
return: bool True if set (so that a line should be drawn)

_setFont()   X-Ref
Set the PDF font


setFillImage($filename)   X-Ref
Sets an image that should be used for filling.

Image filling is not supported with PDF, filling 'transparent'

param: string $filename The filename of the image to fill with

setGradientFill($gradient)   X-Ref
Sets a gradient fill

Gradient filling is not supported with PDF, end color used as solid fill.

param: array $gradient Gradient fill options

setFont($fontOptions)   X-Ref
Sets the font options.

The $font array may have the following entries:

'ttf' = the .ttf file (either the basename, filename or full path)
If 'ttf' is specified, then the following can be specified

'size' = size in pixels

'angle' = the angle with which to write the text

param: array $font The font options.

_reset()   X-Ref
Resets the canvas.

Includes fillstyle, linestyle, thickness and polygon


line($params)   X-Ref
Draw a line

Parameter array:
'x0': int X start point
'y0': int Y start point
'x1': int X end point
'y1': int Y end point
'color': mixed [optional] The line color
param: array $params Parameter array

polygon($params = array()   X-Ref
Parameter array:
'connect': bool [optional] Specifies whether the start point should be
connected to the endpoint (closed polygon) or not (connected line)
'fill': mixed [optional] The fill color
'line': mixed [optional] The line color

param: array $params Parameter array

rectangle($params)   X-Ref
Draw a rectangle

Parameter array:
'x0': int X start point
'y0': int Y start point
'x1': int X end point
'y1': int Y end point
'fill': mixed [optional] The fill color
'line': mixed [optional] The line color
param: array $params Parameter array

ellipse($params)   X-Ref
Draw an ellipse

Parameter array:
'x': int X center point
'y': int Y center point
'rx': int X radius
'ry': int Y radius
'fill': mixed [optional] The fill color
'line': mixed [optional] The line color
param: array $params Parameter array

pieslice($params)   X-Ref
Draw a pie slice

Parameter array:
'x': int X center point
'y': int Y center point
'rx': int X radius
'ry': int Y radius
'v1': int The starting angle (in degrees)
'v2': int The end angle (in degrees)
'srx': int [optional] Starting X-radius of the pie slice (i.e. for a doughnut)
'sry': int [optional] Starting Y-radius of the pie slice (i.e. for a doughnut)
'fill': mixed [optional] The fill color
'line': mixed [optional] The line color
param: array $params Parameter array

textWidth($text)   X-Ref
Get the width of a text,

param: string $text The text to get the width of
return: int The width of the text

textHeight($text)   X-Ref
Get the height of a text,

param: string $text The text to get the height of
return: int The height of the text

addText($params)   X-Ref
Writes text

Parameter array:
'x': int X-point of text
'y': int Y-point of text
'text': string The text to add
'alignment': array [optional] Alignment
'color': mixed [optional] The color of the text

image($params)   X-Ref
Overlay image

Parameter array:
'x': int X-point of overlayed image
'y': int Y-point of overlayed image
'filename': string The filename of the image to overlay
'width': int [optional] The width of the overlayed image (resizing if possible)
'height': int [optional] The height of the overlayed image (resizing if possible)
'alignment': array [optional] Alignment

show($param = false)   X-Ref
Output the result of the canvas

param: array $param Parameter array

save($param = false)   X-Ref
Output the result of the canvas

param: array $param Parameter array

toHtml($params)   X-Ref
Get a canvas specific HTML tag.

This method implicitly saves the canvas to the filename in the
filesystem path specified and parses it as URL specified by URL path

Parameter array:
'filename': string
'filepath': string Path to the file on the file system. Remember the final slash
'urlpath': string Path to the file available through an URL. Remember the final slash
'title': string The url title

_version()   X-Ref
Check which major version of PDFlib is installed

return: int The mahor version number of PDFlib



Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7