File_PDF
[ class tree: File_PDF ] [ index: File_PDF ] [ all elements ]

Class: File_PDF

Source Location: /File_PDF-0.0.1/PDF.php

Class Overview


File_PDF::


Author(s):

Version:

  • $Revision: 1.17 $

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 23]
File_PDF::

The File_PDF:: class provides a PHP-only implementation of a PDF library. No external libs or PHP extensions are required.

Based on the FPDF class by Olivier Plathey (http://www.fpdf.org).

Copyright 2003-2004 Olivier Plathey <olivier@fpdf.org> Copyright 2003-2004 Marko Djukic <marko@oblo.com>

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

$Horde: framework/File_PDF/PDF.php,v 1.17 2004/05/20 07:43:42 mdjukic Exp $



[ Top ]


Class Variables

$fh =

[line 113]


Type:   mixed


[ Top ]

$fhPt =

[line 105]


Type:   mixed


[ Top ]

$fw =

[line 113]

Current dimensions of page format in user units.

Type:   $fw;


[ Top ]

$fwPt =

[line 105]

Current dimensions of page format in points.
  • Var: float

Type:   $fwPt


[ Top ]

$h =

[line 129]


Type:   mixed


[ Top ]

$hPt =

[line 121]


Type:   mixed


[ Top ]

$w =

[line 129]

Current dimensions of page in user units

Type:   $w;


[ Top ]

$wPt =

[line 121]

Current dimensions of page in points.

Type:   $wPt;


[ Top ]

$x =

[line 181]

The current horizontal and vertical position for cell positioning.

Value is set in user units and is calculated from the top left corner as origin.

  • Var: float

Type:   $x


[ Top ]

$y =

[line 181]


Type:   mixed


[ Top ]



Method Detail

acceptPageBreak   [line 1540]

bool acceptPageBreak( )

Whenever a page break condition is met, the method is called, and the break is issued or not depending on the returned value. The default implementation returns a value according to the mode selected by File_PDF:setAutoPageBreak.

This method is called automatically and should not be called directly by the application.

  • See: File_PDF::setAutoPageBreak.
  • Access: public

[ Top ]

addFont   [line 1222]

void addFont( string $family, [optional $style = ''], [optional $file = ''])

Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility.

The location of the definition file (and the font file itself when embedding) must be found at the full path name included.

Example: $pdf->addFont('Comic', 'I'); is equivalent to: $pdf->addFont('Comic', 'I', 'comici.php');

  • See: File_PDF::setFont
  • Access: public

Parameters:

optional   $style   —  Font style. Possible values are (case insensitive):
  • empty string: regular (default)
  • B: bold
  • I: italic
  • BI or IB: bold italic
string   $family   —  family Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.
optional   $file   —  string $file The font definition file. By default, the name is built from the family and style, in lower case with no space.

[ Top ]

addLink   [line 1428]

void addLink( )

Creates a new internal link and returns its identifier. An internal link is a clickable area which directs to another place within the document.

The identifier can then be passed to File_PDF::cell, File_PDF::write, File_PDF::image or File_PDF::link. The destination is defined with File_PDF::setLink.

  • See: File_PDF::Link
  • See: File_PDF::SetLink
  • See: File_PDF::image
  • See: File_PDF::Write
  • See: File_PDF::cell
  • Access: public

[ Top ]

addPage   [line 796]

void addPage( [optional $orientation = ''])

Adds a new page to the document. If a page is already present, the

File_PDF::footer method is called first to output the footer. Then the page is added, the current position set to the top-left corner according to the left and top margins, and File_PDF::header is called to display the header. The font which was set before calling is automatically restored. There is no need to call File_PDF::setFont again if you want to continue with the same font. The same is true for colors and line width. The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.

  • See: File_PDF::setMargins
  • See: File_PDF::footer
  • See: File_PDF::header
  • See: File_PDF::PDF
  • Access: public

Parameters:

optional   $orientation   —  string $orientation Page orientation. Possible values are (case insensitive):
  • P or Portrait
  • L or Landscape
The default value is the one passed to the constructor.

[ Top ]

aliasNbPages   [line 723]

void aliasNbPages( [optional $alias = '{nb}'])

Defines an alias for the total number of pages. It will be substituted as the document is closed.

Example: class My_File_PDF extends File_PDF { function footer() { // Go to 1.5 cm from bottom $this->setY(-15); // Select Arial italic 8 $this->setFont('Arial', 'I', 8); // Print current and total page numbers $this->cell(0, 10, 'Page ' . $this->getPageNo() . '/{nb}', 0, 0, 'C'); } } $pdf = &My_File_PDF::factory(); $pdf->aliasNbPages();

  • See: File_PDF::footer
  • See: File_PDF::getPageNo
  • Access: public

Parameters:

optional   $alias   —  string $alias The alias. Default value: {nb}.

[ Top ]

cell   [line 1599]

void cell( float $width, [optional $height = 0], [optional $text = ''], [optional $border = 0], [optional $ln = 0], [optional $align = ''], [optional $fill = 0], [optional $link = ''])

Prints a cell (rectangular area) with optional borders, background

color and character string. The upper-left corner of the cell corresponds to the current position. The text can be aligned or centered. After the call, the current position moves to the right or to the next line. It is possible to put a link on the text. If automatic page breaking is enabled and the cell goes beyond the limit, a page break is done before outputting.

  • See: File_PDF::multiCell
  • See: File_PDF::Write
  • See: File_PDF::setAutoPageBreak
  • See: File_PDF::newLine
  • See: File_PDF::addLink
  • See: File_PDF::setDrawColor
  • See: File_PDF::setFillColor
  • See: File_PDF::setLineWidth
  • See: File_PDF::setFont

Parameters:

float   $width   —  Cell width. If 0, the cell extends up to the right margin.
optional   $height   —  float $height Cell height. Default value: 0.
optional   $text   —  string $text String to print. Default value: empty.
optional   $border   —  mixed $border Indicates if borders must be drawn around the cell. The value can be either a number:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
optional   $ln   —  int $ln Indicates where the current position should go after the call. Possible values are:
  • 0: to the right (default)
  • 1: to the beginning of the next line
  • 2: below
Putting 1 is equivalent to putting 0 and calling File_PDF::newLine just after.
optional   $align   —  string $align Allows to center or align the text. Possible values are:
  • L or empty string: left (default)
  • C: center
  • R: right
optional   $fill   —  int $fill Indicates if the cell fill type. Possible values are:
  • 0: transparent (default)
  • 1: painted
optional   $link   —  string $link URL or identifier returned by File_PDF:addLink.

[ Top ]

circle   [line 1134]

void circle( float $x, float $y, float $r, [optional $style = ''])

Outputs a circle. It can be drawn (border only), filled (with no border) or both.
  • Access: public

Parameters:

float   $x   —  Abscissa of the center of the circle.
float   $y   —  Ordinate of the center of the circle.
float   $r   —  Circle radius.
optional   $style   —  string $style Style of rendering. Possible values are:
  • D or empty string: draw (default)
  • F: fill
  • DF or FD: draw and fill

[ Top ]

close   [line 754]

void close( )

Terminates the PDF document. It is not necessary to call this method explicitly because File_PDF::output does it automatically.

If the document contains no page, File_PDF::addPage is called to prevent from getting an invalid document.

  • See: File_PDF::output
  • See: File_PDF::open
  • Access: public

[ Top ]

factory   [line 415]

void &factory( [optional $orientation = 'P'], [optional $unit = 'mm'], [optional $format = 'A4'])

Attempts to return a conrete PDF instance. It allows to set up the page format, the orientation and the units of measurement used in all the methods (except for the font sizes).

Example: $pdf = &File_PDF::factory('P', 'mm', 'A4');

  • Access: public

Parameters:

optional   $orientation   —  string $orientation Default page orientation. Possible values are (case insensitive):
  • P or Portrait (default)
  • L or Landscape
optional   $unit   —  string $unit User measure units. Possible values values are:
  • pt: point
  • mm: millimeter (default)
  • cm: centimeter
  • in: inch
A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
optional   $format   —  mixed format The format used for pages. It can be either one of the following values (case insensitive):
  • A3
  • A4 (default)
  • A5
  • Letter
  • Legal
or a custom format in the form of a two-element array containing the width and the height (expressed in the unit given by unit).

[ Top ]

footer   [line 911]

void footer( )

This method is used to render the page footer. It is automatically

called by File_PDF::addPage and File_PDF::close and should not be called directly by the application. The implementation in File_PDF:: is empty, so you have to subclass it and override the method if you want a specific processing.

Example:

class My_File_PDF extends File_PDF { function footer() { // Go to 1.5 cm from bottom $this->setY(-15); // Select Arial italic 8 $this->setFont('Arial', 'I', 8); // Print centered page number $this->cell(0, 10, 'Page ' . $this->getPageNo(), 0, 0, 'C'); } }

  • See: File_PDF::header
  • Access: public

[ Top ]

getOutput   [line 2195]

void getOutput( )

Returns the raw PDF file.
  • See: File_PDF::output
  • Access: public

[ Top ]

getPageNo   [line 925]

int getPageNo( )

Returns the current page number.
  • See: File_PDF::aliasNbPages
  • Access: public

[ Top ]

getStringWidth   [line 1023]

float getStringWidth( string $text, [optional $pt = false])

Returns the length of a text string. A font must be selected.
  • Access: public

Parameters:

string   $text   —  The text whose length is to be computed.
optional   $pt   —  bool $pt Boolean to indicate if the width should be returned in points or user unit. Default false.

[ Top ]

getX   [line 2102]

float getX( )

Returns the abscissa of the current position in user units.
  • See: File_PDF::setY
  • See: File_PDF::getY
  • See: File_PDF::setX
  • Access: public

[ Top ]

getY   [line 2142]

float getY( )

Returns the ordinate of the current position in user units.
  • See: File_PDF::setX
  • See: File_PDF::getX
  • See: File_PDF::setY
  • Access: public

[ Top ]

header   [line 881]

void header( )

This method is used to render the page header. It is automatically called by File_PDF::addPage and should not be called directly by the application. The implementation in File_PDF:: is empty, so you have to subclass it and override the method if you want a specific processing.

Example:

class My_File_PDF extends File_PDF { function header() { // Select Arial bold 15 $this->setFont('Arial', 'B', 15); // Move to the right $this->cell(80); // Framed title $this->cell(30, 10, 'Title', 1, 0, 'C'); // Line break $this->newLine(20); } }

  • See: File_PDF::footer
  • Access: public

[ Top ]

image   [line 2017]

void image( string $file, float $x, float $y, [float $width = 0], [optional $height = 0], [string $type = ''], [mixed $link = ''])

Prints an image in the page. The upper-left corner and at least one of the dimensions must be specified; the height or the width can be calculated automatically in order to keep the image proportions.

Supported formats are JPEG and PNG.

For JPEG, all flavors are allowed:

  • gray scales
  • true colors (24 bits)
  • CMYK (32 bits)
For PNG, are allowed:
  • gray scales on at most 8 bits (256 levels)
  • indexed colors
  • true colors (24 bits)
but are not supported:
  • Interlacing
  • Alpha channel
If a transparent color is defined, it will be taken into account (but will be only interpreted by Acrobat 4 and above). The format can be specified explicitly or inferred from the file extension. It is possible to put a link on the image.

Remark: if an image is used several times, only one copy will be embedded in the file.

  • See: File_PDF::addLink
  • Access: public

Parameters:

string   $file   —  Name of the file containing the image.
float   $x   —  Abscissa of the upper-left corner.
float   $y   —  Ordinate of the upper-left corner.
float   $width   —  Width of the image in the page. If equal to zero, it is automatically calculated to keep the original proportions.
string   $type   —  Image format. Possible values are (case insensitive) : JPG, JPEG, PNG. If not specified, the type is inferred from the file extension.
mixed   $link   —  URL or identifier returned by File_PDF::addLink.
optional   $height   —  float $height Height of the image in the page. If not specified or equal to zero, it is automatically calculated to keep the original proportions.

[ Top ]

line   [line 1077]

void line( float $x1, float $y1, float $x2, float $y2)

Draws a line between two points.
  • See: File_PDF::setDrawColor.
  • See: File_PDF::setLineWidth
  • Access: public

Parameters:

float   $x1   —  Abscissa of first point.
float   $y1   —  Ordinate of first point.
float   $x2   —  Abscissa of second point.
float   $y2   —  Ordinate of second point.

[ Top ]

link   [line 1480]

void link( float $x, float $y, float $width, float $height, mixed $link)

Puts a link on a rectangular area of the page. Text or image links are generally put via File_PDF::cell, File_PDF::Write or File_PDF::image, but this method can be useful for instance to define a clickable area inside an image.
  • See: File_PDF::image
  • See: File_PDF::Write
  • See: File_PDF::cell
  • See: File_PDF::addLink
  • Access: public

Parameters:

float   $x   —  Abscissa of the upper-left corner of the rectangle.
float   $y   —  Ordinate of the upper-left corner of the rectangle.
float   $width   —  Width of the rectangle.
float   $height   —  Height of the rectangle.
mixed   $link   —  URL or identifier returned by File_PDF::addLink.

[ Top ]

multiCell   [line 1719]

void multiCell( float $width, float $height, string $text, [optional $border = 0], [optional $align = 'J'], [optional $fill = 0])

This method allows printing text with line breaks. They can be automatic (as soon as the text reaches the right border of the cell) or explicit (via the \n character). As many cells as necessary are output, one below the other.

Text can be aligned, centered or justified. The cell block can be framed and the background painted.

  • See: File_PDF::cell
  • See: File_PDF::write
  • See: File_PDF::setAutoPageBreak
  • See: File_PDF::setLineWidth
  • See: File_PDF::setFillColor
  • See: File_PDF::setFont
  • See: File_PDF::setDrawColor
  • Access: public

Parameters:

float   $width   —  Width of cells. If 0, they extend up to the right margin of the page.
float   $height   —  Height of cells.
string   $text   —  String to print.
optional   $border   —  mixed $border Indicates if borders must be drawn around the cell block. The value can be either a number:
  • 0: no border (default)
  • 1: frame
or a string containing some or all of the following characters (in any order):
  • L: left
  • T: top
  • R: right
  • B: bottom
optional   $align   —  string $align Sets the text alignment. Possible values are:
  • L: left alignment
  • C: center
  • R: right alignment
  • J: justification (default value)
optional   $fill   —  int $fill Indicates if the cell background must:
  • 0: transparent (default)
  • 1: painted

[ Top ]

newLine   [line 2081]

void newLine( [optional $height = ''])

Performs a line break. The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.
  • See: File_PDF::cell
  • Access: public

Parameters:

optional   $height   —  float $height The height of the break. By default, the value equals the height of the last printed cell.

[ Top ]

open   [line 738]

void open( )

This method begins the generation of the PDF document; it must be called before any output commands. No page is created by this method, therefore it is necessary to call File_PDF::addPage.
  • See: File_PDF::close
  • See: File_PDF::addPage
  • Access: public

[ Top ]

output   [line 2213]

void output( [optional $filename = 'unknown.pdf'], [optional $inline = false])

Function to output the buffered data to the browser.
  • Access: public

Parameters:

optional   $filename   —  string $filename The filename for the output file.
optional   $inline   —  bool $inline True if inline, false if attachment.

[ Top ]

raiseError   [line 509]

object PEAR_Error raiseError( mixed $error)

Returns a PEAR_Error object. Wraps around PEAR::raiseError() to avoid having to include PEAR.php unless an error occurs.

Parameters:

mixed   $error   —  The error message.

[ Top ]

rect   [line 1101]

void rect( float $x, float $y, float $width, float $height, [optional $style = ''])

Outputs a rectangle. It can be drawn (border only), filled (with no border) or both.
  • See: File_PDF::setFillColor
  • See: File_PDF::setDrawColor
  • See: File_PDF::setLineWidth
  • Access: public

Parameters:

float   $x   —  Abscissa of upper-left corner.
float   $y   —  Ordinate of upper-left corner.
float   $width   —  Width.
float   $height   —  Height.
optional   $style   —  float $style Style of rendering. Possible values are:
  • D or empty string: draw (default)
  • F: fill
  • DF or FD: draw and fill

[ Top ]

save   [line 2246]

void save( [optional $filename = 'unknown.pdf'])

Function to save the PDF file somewhere local to the server.
  • Access: public

Parameters:

optional   $filename   —  string $filename The filename for the output file.

[ Top ]

setAutoPageBreak   [line 603]

void setAutoPageBreak( bool $auto, [optional $margin = 0])

Enables or disables the automatic page breaking mode. When enabling, the second parameter is the distance from the bottom of the page that defines the triggering limit. By default, the mode is on and the margin is 2 cm.
  • Access: public

Parameters:

bool   $auto   —  auto Boolean indicating if mode should be on or off.
optional   $margin   —  float $margin Distance from the bottom of the page.

[ Top ]

setCompression   [line 667]

void setCompression( bool $compress)

Activates or deactivates page compression. When activated, the internal representation of each page is compressed, which leads to a compression ratio of about 2 for the resulting document.

Compression is on by default. Note: the Zlib extension is required for this feature. If not present, compression will be turned off.


Parameters:

bool   $compress   —  Boolean indicating if compression must be enabled or not.

[ Top ]

setDisplayMode   [line 635]

void setDisplayMode( mixed $zoom, [optional $layout = 'continuous'])

Defines the way the document is to be displayed by the viewer. The zoom

level can be set: pages can be displayed entirely on screen, occupy the full width of the window, use real size, be scaled by a specific zooming factor or use viewer default (configured in the Preferences menu of Acrobat). The page layout can be specified too: single at once, continuous display, two columns or viewer default. By default, documents use the full width mode with continuous display.

  • Access: public

Parameters:

mixed   $zoom   —  The zoom to use. It can be one of the following string values:
  • fullpage: entire page on screen
  • fullwidth: maximum width of window
  • real: uses real size (100% zoom)
  • default: uses viewer default mode
or a number indicating the zooming factor.
optional   $layout   —  string layout The page layout. Possible values are:
  • single: one page at once
  • continuous: pages in continuously
  • two: two pages on two columns
  • default: uses viewer default mode
Default value is continuous.

[ Top ]

setDrawColor   [line 997]

void setDrawColor( [string $cs = 'rgb'], float $c1, [optional $c2 = 0], [optional $c3 = 0], [optional $c4 = 0])

Sets the draw color, used when drawing lines. Depending on the colorspace called, the number of color component parameters required can be either 1, 3 or 4. The method can be called before the first page is created and the color is retained from page to page.
  • See: File_PDF::cell
  • See: File_PDF::multiCell
  • See: File_PDF::rect
  • See: File_PDF::line
  • See: File_PDF::setFillColor
  • Access: public

Parameters:

string   $cs   —  Indicates the colorspace which can be either 'rgb', 'cmyk' or 'gray'. Defaults to 'rgb'.
float   $c1   —  First color component, floating point value between 0 and 1. Required for gray, rgb and cmyk.
optional   $c2   —  float $c2 Second color component, floating point value between 0 and 1. Required for rgb and cmyk.
optional   $c3   —  float $c3 Third color component, floating point value between 0 and 1. Required for rgb and cmyk.
optional   $c4   —  float $c4 Fourth color component, floating point value between 0 and 1. Required for cmyk.

[ Top ]

setFillColor   [line 956]

void setFillColor( [string $cs = 'rgb'], float $c1, [optional $c2 = 0], [optional $c3 = 0], [optional $c4 = 0])

Sets the fill color. Specifies the color for both filled areas and

text. Depending on the colorspace called, the number of color component parameters required can be either 1, 3 or 4. The method can be called before the first page is created and the color is retained from page to page.

  • See: File_PDF::multiCell
  • See: File_PDF::cell
  • See: File_PDF::rect
  • See: File_PDF::setDrawColor
  • Access: public

Parameters:

string   $cs   —  Indicates the colorspace which can be either 'rgb', 'cmyk' or 'gray'. Defaults to 'rgb'.
float   $c1   —  First color component, floating point value between 0 and 1. Required for gray, rgb and cmyk.
optional   $c2   —  float $c2 Second color component, floating point value between 0 and 1. Required for rgb and cmyk.
optional   $c3   —  float $c3 Third color component, floating point value between 0 and 1. Required for rgb and cmyk.
optional   $c4   —  float $c4 Fourth color component, floating point value between 0 and 1. Required for cmyk.

[ Top ]

setFont   [line 1314]

void setFont( string $family, [optional $style = ''], [optional $size = null])

Sets the font used to print character strings. It is mandatory to call

this method at least once before printing text or the resulting document would not be valid. The font can be either a standard one or a font added via the File_PDF::addFont method. Standard fonts use Windows encoding cp1252 (Western Europe). The method can be called before the first page is created and the font is retained from page to page. If you just wish to change the current font size, it is simpler to call File_PDF::setFontSize.

  • See: File_PDF::multiCell
  • See: File_PDF::Write
  • See: File_PDF::cell
  • See: File_PDF::setFontSize
  • See: File_PDF::addFont
  • Access: public

Parameters:

string   $family   —  Family font. It can be either a name defined by File_PDF::addFont or one of the standard families (case insensitive):
  • Courier (fixed-width)
  • Helvetica or Arial (sans serif)
  • Times (serif)
  • Symbol (symbolic)
  • ZapfDingbats (symbolic)
It is also possible to pass an empty string. In that case, the current family is retained.
optional   $style   —  string $style Font style. Possible values are (case insensitive):
  • empty string: regular
  • B: bold
  • I: italic
  • U: underline
or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats.
optional   $size   —  int $size Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12.

[ Top ]

setFontSize   [line 1395]

void setFontSize( float $size)

Defines the size of the current font.
  • See: File_PDF::setFont
  • Access: public

Parameters:

float   $size   —  The size (in points).

[ Top ]

setInfo   [line 687]

void setInfo( mixed $info, [optional $value = ''])

Set the info to a document. Possible info settings are:

  • title
  • subject
  • author
  • keywords
  • creator


Parameters:

mixed   $info   —  If passed as an array then the complete hash containing the info to be inserted into the document. Otherwise the name of setting to be set.
optional   $value   —  string $value The value of the setting.

[ Top ]

setLeftMargin   [line 555]

void setLeftMargin( float $margin)

Defines the left margin. The method can be called before creating the first page.

If the current abscissa gets out of page, it is brought back to the margin.

  • See: File_PDF::setTopMargin
  • See: File_PDF::setRightMargin
  • See: File_PDF::setMargins
  • See: File_PDF::setAutoPageBreak
  • Access: public

Parameters:

float   $margin   —  The margin.

[ Top ]

setLineWidth   [line 1056]

void setLineWidth( float $width)

Defines the line width. By default, the value equals 0.2 mm. The method can be called before the first page is created and the value is retained from page to page.
  • See: File_PDF::multiCell
  • See: File_PDF::cell
  • See: File_PDF::rect
  • See: File_PDF::line
  • Access: public

Parameters:

float   $width   —  The width.

[ Top ]

setLink   [line 1450]

void setLink( int $link, [optional $y = 0], [optional $page = -1])

Defines the page and position a link points to.
  • See: File_PDF::addLink
  • Access: public

Parameters:

int   $link   —  The link identifier returned by File_PDF::addLink.
optional   $y   —  float $y Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page).
optional   $page   —  int $page Number of target page; -1 indicates the current page. This is the default value.

[ Top ]

setMargins   [line 531]

void setMargins( float $left, float $top, [optional $right = null])

Defines the left, top and right margins. By default, they equal
  1. cm. Call this method to change them.

  • See: File_PDF::setTopMargin
  • See: File_PDF::setRightMargin
  • See: File_PDF::setLeftMargin
  • See: File_PDF::setAutoPageBreak
  • Access: public

Parameters:

float   $left   —  Left margin.
float   $top   —  Top margin.
optional   $right   —  float $right Right margin. If not specified default to the value of the left one.

[ Top ]

setRightMargin   [line 586]

void setRightMargin( float $margin)

Defines the right margin. The method can be called before creating the first page.
  • Access: public

Parameters:

float   $margin   —  The margin.

[ Top ]

setTopMargin   [line 573]

void setTopMargin( float $margin)

Defines the top margin. The method can be called before creating the first page.
  • Access: public

Parameters:

float   $margin   —  The margin.

[ Top ]

setX   [line 2120]

void setX( float $x)

Defines the abscissa of the current position. If the passed value is negative, it is relative to the right of the page.
  • See: File_PDF::setXY
  • See: File_PDF::setY
  • See: File_PDF::getY
  • See: File_PDF::getX
  • Access: public

Parameters:

float   $x   —  The value of the abscissa.

[ Top ]

setXY   [line 2182]

void setXY( float $x, float $y)

Defines the abscissa and ordinate of the current position. If the passed values are negative, they are relative respectively to the right and bottom of the page.
  • See: File_PDF::setY
  • See: File_PDF::setX
  • Access: public

Parameters:

float   $x   —  The value of the abscissa.
float   $y   —  The value of the ordinate.

[ Top ]

setY   [line 2160]

void setY( float $y)

Defines the ordinate of the current position. If the passed value is negative, it is relative to the bottom of the page.
  • See: File_PDF::setXY
  • See: File_PDF::setY
  • See: File_PDF::getY
  • See: File_PDF::getX
  • Access: public

Parameters:

float   $y   —  The value of the ordinate.

[ Top ]

text   [line 1510]

void text( float $x, float $y, string $text)

Prints a character string. The origin is on the left of the first

character, on the baseline. This method allows to place a string precisely on the page, but it is usually easier to use File_PDF::cell, File_PDF::multiCell or File_PDF::Write which are the standard methods to print text.

  • See: File_PDF::Write
  • See: File_PDF::multiCell
  • See: File_PDF::cell
  • See: File_PDF::setFont
  • Access: public

Parameters:

float   $x   —  Abscissa of the origin.
float   $y   —  Ordinate of the origin.
string   $text   —  String to print.

[ Top ]

write   [line 1851]

void write( float $height, string $text, [optional $link = ''])

This method prints text from the current position. When the right margin is reached (or the \n character is met) a line break occurs and text continues from the left margin. Upon method exit, the current position is left just at the end of the text.

It is possible to put a link on the text.

Example: //Begin with regular font $pdf->setFont('Arial','',14); $pdf->write(5,'Visit '); //Then put a blue underlined link $pdf->setTextColor(0,0,255); $pdf->setFont('','U'); $pdf->write(5,'www.fpdf.org','http://www.fpdf.org');

  • See: File_PDF::setAutoPageBreak
  • See: File_PDF::multiCell
  • See: File_PDF::addLink
  • See: File_PDF::setFont
  • Access: public

Parameters:

float   $height   —  Line height.
string   $text   —  String to print.
optional   $link   —  mixed $link URL or identifier returned by AddLink().

[ Top ]

writeRotated   [line 1944]

none writeRotated( int $x, int $y, string $text, float $text_angle, [optional $font_angle = 0])

write Rotated Text.

Write text at an angle.

  • See: File_PDF::setFont
  • Access: public

Parameters:

int   $x   —  X coordinate.
int   $y   —  Y coordinate.
string   $text   —  Text to write.
float   $text_angle   —  Angle to rotate (Eg. 90 = bottom to top).
optional   $font_angle   —  float $font_angle Rotate characters as well as text.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 10:17:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.