Class File_PDF

Description

Located in /File_PDF/PDF.php (line 39)


	
			
Variable Summary
 float $fh
 float $fhPt
 float $fw
 float $fwPt
 float $h
 float $hPt
 float $w
 float $wPt
 float $x
 float $y
 string $_buffer
 integer $_buflen
 boolean $_color_flag
 boolean $_compress
 array $_core_fonts
 array $_diffs
 string $_draw_color
 string $_fill_color
 boolean $_flushed
 array $_fonts
 string $_font_family
 array $_font_files
 float $_font_size
 string $_font_style
 array $_images
 array $_info
 boolean $_in_footer
 string $_layout_mode
 float $_line_width
 array $_links
 integer $_n
 array $_offsets
 integer $_page
 array $_pages
 array $_page_links
 float $_scale
 integer $_state
 string $_text_color
 float $_top_margin
 boolean $_underline
 integer $_word_spacing
 string $_zoom_mode
Method Summary
 boolean acceptPageBreak ()
 void addFont (string $family, [string $style = ''], [string $file = ''])
 void addLink ()
 void addPage ([string $orientation = ''])
 void aliasNbPages ([string $alias = '{nb}'])
 void cell (float $width, [float $height = 0], [string $text = ''], [mixed $border = 0], [integer $ln = 0], [string $align = ''], [integer $fill = 0], [string $link = ''])
 void circle (float $x, float $y, float $r, [string $style = ''])
 void close ()
 void &factory ([array $params = array()], [string $class = 'File_PDF'])
 void flush ()
 void footer ()
 void getOutput ()
 float getPageHeight ()
 integer getPageNo ()
 float getPageWidth ()
 float getStringWidth (string $text, [boolean $pt = false])
 float getX ()
 float getY ()
 void header ()
 void image (string $file, float $x, float $y, [float $width = 0], [float $height = 0], [string $type = ''], [mixed $link = ''])
 void line (float $x1, float $y1, float $x2, float $y2)
 void link (float $x, float $y, float $width, float $height, mixed $link)
 void multiCell (float $width, float $height, string $text, [mixed $border = 0], [string $align = 'J'], [integer $fill = 0])
 void newLine ([float $height = ''])
 void open ()
 void output ([string $filename = 'unknown.pdf'], [boolean $inline = false])
 object PEAR_Error raiseError (mixed $error)
 void rect (float $x, float $y, float $width, float $height, [float $style = ''])
 void save ([string $filename = 'unknown.pdf'])
 void setAutoPageBreak (boolean $auto, [float $margin = 0])
 void setCompression (boolean $compress)
 void setDisplayMode (mixed $zoom, [string $layout = 'continuous'])
 void setDrawColor ([string $cs = 'rgb'], float $c1, [float $c2 = 0], [float $c3 = 0], [float $c4 = 0])
 void setFillColor ([string $cs = 'rgb'], float $c1, [float $c2 = 0], [float $c3 = 0], [float $c4 = 0])
 void setFont (string $family, [string $style = ''], [integer $size = null], [boolean $force = false])
 void setFontSize (float $size)
 void setFontStyle (string $style)
 void setInfo (array|string $info, [string $value = ''])
 void setLeftMargin (float $margin)
 void setLineWidth (float $width)
 void setLink (integer $link, [float $y = 0], [integer $page = -1])
 void setMargins (float $left, float $top, [float $right = null])
 void setRightMargin (float $margin)
 void setTextColor (string $cs, float $c1, [float $c2 = 0], [float $c3 = 0], [float $c4 = 0])
 void setTopMargin (float $margin)
 void setX (float $x)
 void setXY (float $x, float $y)
 void setY (float $y)
 void text (float $x, float $y, string $text)
 void write (float $height, string $text, [mixed $link = ''])
 void writeRotated (integer $x, integer $y, string $text, float $text_angle, [float $font_angle = 0])
 void _beginDoc ()
 void _beginPage ( $orientation)
 void _doUnderline ( $x,  $y,  $text)
 void _endDoc ()
 void _endPage ()
 void _escape ( $s)
 void _freadInt ( $f)
 void _getFontFile ( $fontkey, [ $path = ''])
 void _link ( $x,  $y,  $width,  $height,  $link)
 void _newobj ()
 void _out ( $s)
 void _parseJPG ( $file)
 void _parsePNG ( $file)
 void _putCatalog ()
 void _putFonts ()
 void _putImages ()
 void _putInfo ()
 void _putPages ()
 void _putResources ()
 void _putStream ( $s)
 void _putTrailer ()
 void _textString ( $s)
 void _toPt ( $val)
Variables
float $fh (line 156)

Current height of page format in user units.

float $fhPt (line 142)

Current height of page format in points.

float $fw (line 149)

Current width of page format in user units.

float $fwPt (line 135)

Current width of page format in points.

float $h (line 184)

Current height of page in user units

float $hPt (line 170)

Current height of page in points.

float $w (line 177)

Current width of page in user units

float $wPt (line 163)

Current width of page in points.

float $x (line 235)

The current horizontal position for cell positioning.

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

float $y (line 244)

The current vertical position for cell positioning.

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

string $_alias_nb_pages = '{nb}' (line 451)

Alias for total number of pages.

boolean $_auto_page_break (line 404)

Automatic page breaking.

float $_break_margin (line 219)

Break page margin size, the bottom margin which triggers a page break.

string $_buffer = '' (line 67)

Buffer holding in-memory PDF.

integer $_buflen = 0 (line 74)

Buffer length, including already flushed content.

float $_cell_margin (line 226)

Cell margin size.

boolean $_color_flag = false (line 383)

Whether text color is different from fill color.

boolean $_compress (line 107)

Flag indicating if PDF file is to be compressed or not.

array $_core_fonts = array('courier' => 'Courier',
'courierB' => 'Courier-Bold',
'courierI' => 'Courier-Oblique',
'courierBI' => 'Courier-BoldOblique',
'helvetica' => 'Helvetica',
'helveticaB' => 'Helvetica-Bold',
'helveticaI' => 'Helvetica-Oblique',
'helveticaBI' => 'Helvetica-BoldOblique',
'times' => 'Times-Roman',
'timesB' => 'Times-Bold',
'timesI' => 'Times-Italic',
'timesBI' => 'Times-BoldItalic',
'symbol' => 'Symbol',
'zapfdingbats' => 'ZapfDingbats')
(line 265)

An array of standard font names.

array $_current_font (line 348)

An array containing current font info.

string $_current_orientation (line 121)

The current page orientation.

string $_default_orientation (line 114)

The default page orientation.

array $_diffs = array() (line 299)

An array of encoding differences.

string $_draw_color = '0 G' (line 390)

Commands for drawing color.

string $_fill_color = '0 g' (line 369)

Commands for filling color.

boolean $_flushed = false (line 81)

Whether the buffer has been flushed already.

array $_fonts = array() (line 285)

An array of used fonts.

string $_font_family = '' (line 327)

Current font family.

array $_font_files = array() (line 292)

An array of font files.

float $_font_size = 12 (line 362)

Current font size in user units.

float $_font_size_pt = 12 (line 355)

Current font size in points.

string $_font_style = '' (line 334)

Current font style.

array $_images = array() (line 306)

An array of used images.

array $_info = array() (line 444)

An array containing the document info, consisting of:

  • title
  • subject
  • author
  • keywords
  • creator

boolean $_in_footer = false (line 418)

Flag set when processing footer.

float $_last_height (line 251)

The height of the last cell printed.

string $_layout_mode (line 432)

Layout display mode.

float $_left_margin (line 198)

Left page margin size.

float $_line_width (line 258)

Line width in user units.

array $_links = array() (line 320)

An array of internal links.

integer $_n = 2 (line 53)

Current object number.

array $_offsets = array() (line 60)

Array of object offsets.

array $_orientation_changes = array() (line 128)

Array indicating orientation changes.

integer $_page = 0 (line 46)

Current page number.

array $_pages = array() (line 88)

Array containing the pages.

float $_page_break_trigger (line 411)

Threshold used to trigger page breaks.

array $_page_links (line 313)

An array of links in pages.

float $_right_margin (line 212)

Right page margin size.

float $_scale (line 191)

Scale factor (number of points in user units).

integer $_state = 0 (line 100)

Current document state.

  1. - initial state
  2. - document opened
  3. - page opened
  4. - document closed
</pre>

string $_text_color = '0 g' (line 376)

Commands for text color.

float $_top_margin (line 205)

Top page margin size.

boolean $_underline = false (line 341)

Underlining flag.

integer $_word_spacing = 0 (line 397)

Word spacing.

string $_zoom_mode (line 425)

Zoom display mode.

Methods
acceptPageBreak (line 1789)

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 setAutoPageBreak().

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

boolean acceptPageBreak ()
addFont (line 1434)

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:

  1.  $pdf->addFont('Comic''I');
  2.  is equivalent to:
  3.  $pdf->addFont('Comic''I''comici.php');

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

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 cell(), {@link()} write, image() or link(). The destination is defined with setLink().

void addLink ()
addPage (line 921)

Adds a new page to the document.

If a page is already present, the 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 header() is called to display the header.

The font which was set before calling is automatically restored. There is no need to call 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.

void addPage ([string $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.
aliasNbPages (line 846)

Defines an alias for the total number of pages.

It will be substituted as the document is closed.

Example:

  1.  class My_File_PDF extends File_PDF {
  2.      function footer()
  3.      {
  4.          // Go to 1.5 cm from bottom
  5.          $this->setY(-15);
  6.          // Select Arial italic 8
  7.          $this->setFont('Arial''I'8);
  8.          // Print current and total page numbers
  9.          $this->cell(010'Page ' $this->getPageNo('/{nb}'0,
  10.                      0'C');
  11.      }
  12.  }
  13.  $pdf My_File_PDF::factory();
  14.  $pdf->aliasNbPages();

void aliasNbPages ([string $alias = '{nb}'])
  • string $alias: The alias.
cell (line 1846)

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.

void cell (float $width, [float $height = 0], [string $text = ''], [mixed $border = 0], [integer $ln = 0], [string $align = ''], [integer $fill = 0], [string $link = ''])
  • float $width: Cell width. If 0, the cell extends up to the right margin.
  • float $height: Cell height.
  • string $text: String to print.
  • 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
  • integer $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 newLine() just after.
  • string $align: Allows to center or align the text. Possible values are:
    • L or empty string: left (default)
    • C: center
    • R: right
  • integer $fill: Indicates if the cell fill type. Possible values are:
    • 0: transparent (default)
    • 1: painted
  • string $link: URL or identifier returned by addLink().
circle (line 1340)

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

All coordinates can be negative to provide values from the right or bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).

void circle (float $x, float $y, float $r, [string $style = ''])
  • float $x: Abscissa of the center of the circle.
  • float $y: Ordinate of the center of the circle.
  • float $r: Circle radius.
  • string $style: Style of rendering. Possible values are:
    • D or empty string: draw (default)
    • F: fill
    • DF or FD: draw and fill
close (line 876)

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

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

void close ()
factory (line 497)

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:

  1.  $pdf File_PDF::factory(array('orientation' => 'P',
  2.                                 'unit' => 'mm',
  3.                                 'format' => 'A4'));

void &factory ([array $params = array()], [string $class = 'File_PDF'])
  • array $params: A hash with parameters for the created PDF object. Possible parameters are:
      • P or Portrait (default)
        • 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.
          • 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 the unit parameter).
        • string $class: The concrete class name to return an instance of. Defaults to File_PDF.
        flush (line 2509)

        Returns the current buffer content and resets the buffer.

        Use this method when creating large files to avoid memory problems. This method doesn't work in combination with the output() or save() methods, use getOutput() at the end. Calling this method doubles the memory usage during the call.

        void flush ()
        footer (line 1059)

        This method is used to render the page footer.

        It is automatically called by addPage() and 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:

        1.  class My_File_PDF extends File_PDF {
        2.     function footer()
        3.     {
        4.         // Go to 1.5 cm from bottom
        5.         $this->setY(-15);
        6.         // Select Arial italic 8
        7.         $this->setFont('Arial''I'8);
        8.         // Print centered page number
        9.         $this->cell(010'Page ' $this->getPageNo()00'C');
        10.     }
        11.  }

        void footer ()
        getOutput (line 2528)

        Returns the raw PDF file.

        void getOutput ()
        getPageHeight (line 707)

        Returns the actual page height.

        • return: The page height.
        • since: File_PDF 0.2.0
        • since: Horde 3.2
        float getPageHeight ()
        getPageNo (line 1071)

        Returns the current page number.

        integer getPageNo ()
        getPageWidth (line 694)

        Returns the actual page width.

        • return: The page width.
        • since: File_PDF 0.2.0
        • since: Horde 3.2
        float getPageWidth ()
        getStringWidth (line 1206)

        Returns the length of a text string. A font must be selected.

        float getStringWidth (string $text, [boolean $pt = false])
        • string $text: The text whose length is to be computed.
        • boolean $pt: Whether the width should be returned in points or user units.
        getX (line 2412)

        Returns the abscissa of the current position in user units.

        float getX ()
        getY (line 2450)

        Returns the ordinate of the current position in user units.

        float getY ()
        header (line 1029)

        This method is used to render the page header.

        It is automatically called by 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:

        1.  class My_File_PDF extends File_PDF {
        2.      function header()
        3.      {
        4.          // Select Arial bold 15
        5.          $this->setFont('Arial''B'15);
        6.          // Move to the right
        7.          $this->cell(80);
        8.          // Framed title
        9.          $this->cell(3010'Title'10'C');
        10.          // Line break
        11.          $this->newLine(20);
        12.      }
        13.  }

        void header ()
        image (line 2319)

        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.

        All coordinates can be negative to provide values from the right or bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).

        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.

        void image (string $file, float $x, float $y, [float $width = 0], [float $height = 0], [string $type = ''], [mixed $link = ''])
        • 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.
        • 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.
        • 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 addLink().
        line (line 1260)

        Draws a line between two points.

        All coordinates can be negative to provide values from the right or bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).

        void line (float $x1, float $y1, float $x2, float $y2)
        • float $x1: Abscissa of first point.
        • float $y1: Ordinate of first point.
        • float $x2: Abscissa of second point.
        • float $y2: Ordinate of second point.
        link (line 1712)

        Puts a link on a rectangular area of the page.

        Text or image links are generally put via cell(), write() or image(), but this method can be useful for instance to define a clickable area inside an image.

        All coordinates can be negative to provide values from the right or bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).

        void link (float $x, float $y, float $width, float $height, mixed $link)
        • 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 addLink().
        multiCell (line 1976)

        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.

        void multiCell (float $width, float $height, string $text, [mixed $border = 0], [string $align = 'J'], [integer $fill = 0])
        • 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.
        • 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
        • string $align: Sets the text alignment. Possible values are:
          • L: left alignment
          • C: center
          • R: right alignment
          • J: justification (default value)
        • integer $fill: Indicates if the cell background must:
          • 0: transparent (default)
          • 1: painted
        newLine (line 2393)

        Performs a line break.

        The current abscissa goes back to the left margin and the ordinate increases by the amount passed in parameter.

        void newLine ([float $height = ''])
        • float $height: The height of the break. By default, the value equals the height of the last printed cell.
        open (line 861)

        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 addPage().

        void open ()
        output (line 2547)

        Sends the buffered data to the browser.

        void output ([string $filename = 'unknown.pdf'], [boolean $inline = false])
        • string $filename: The filename for the output file.
        • boolean $inline: True if inline, false if attachment.
        raiseError (line 609)

        Returns a PEAR_Error object.

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

        object PEAR_Error raiseError (mixed $error)
        • mixed $error: The error message.
        rect (line 1299)

        Outputs a rectangle.

        It can be drawn (border only), filled (with no border) or both.

        All coordinates can be negative to provide values from the right or bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).

        void rect (float $x, float $y, float $width, float $height, [float $style = ''])
        • float $x: Abscissa of upper-left corner.
        • float $y: Ordinate of upper-left corner.
        • float $width: Width.
        • float $height: Height.
        • float $style: Style of rendering. Possible values are:
          • D or empty string: draw (default)
          • F: fill
          • DF or FD: draw and fill
        save (line 2586)

        Saves the PDF file on the filesystem.

        void save ([string $filename = 'unknown.pdf'])
        • string $filename: The filename for the output file.
        setAutoPageBreak (line 722)

        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.

        void setAutoPageBreak (boolean $auto, [float $margin = 0])
        • boolean $auto: Boolean indicating if mode should be on or off.
        • float $margin: Distance from the bottom of the page.
        setCompression (line 787)

        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.

        void setCompression (boolean $compress)
        • boolean $compress: Boolean indicating if compression must be enabled or not.
        setDisplayMode (line 753)

        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.

        void setDisplayMode (mixed $zoom, [string $layout = 'continuous'])
        • 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.
        • string $layout: 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.
        setDrawColor (line 1182)

        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.

        void setDrawColor ([string $cs = 'rgb'], float $c1, [float $c2 = 0], [float $c3 = 0], [float $c4 = 0])
        • 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.
        • float $c2: Second color component, floating point value between 0 and 1. Required for rgb and cmyk.
        • float $c3: Third color component, floating point value between 0 and 1. Required for rgb and cmyk.
        • float $c4: Fourth color component, floating point value between 0 and 1. Required for cmyk.
        setFillColor (line 1101)

        Sets the fill color.

        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.

        void setFillColor ([string $cs = 'rgb'], float $c1, [float $c2 = 0], [float $c3 = 0], [float $c4 = 0])
        • 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.
        • float $c2: Second color component, floating point value between 0 and 1. Required for rgb and cmyk.
        • float $c3: Third color component, floating point value between 0 and 1. Required for rgb and cmyk.
        • float $c4: Fourth color component, floating point value between 0 and 1. Required for cmyk.
        setFont (line 1529)

        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 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 setFontSize().

        void setFont (string $family, [string $style = ''], [integer $size = null], [boolean $force = false])
        • string $family: Family font. It can be either a name defined by 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.
        • string $style: Font style. Possible values are (case insensitive):
          • empty string: regular
          • B: bold
          • I: italic
          • U: underline
          or any combination. Bold and italic styles do not apply to Symbol and ZapfDingbats.
        • integer $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.
        • boolean $force: Force the setting of the font. Each new page will require a new call to setFont() and settings this to true will make sure that the checks for same font calls will be skipped.
        setFontSize (line 1612)

        Defines the size of the current font.

        void setFontSize (float $size)
        • float $size: The size (in points).
        setFontStyle (line 1638)

        Defines the style of the current font.

        void setFontStyle (string $style)
        • string $style: The font style.
        setInfo (line 809)

        Set the info to a document.

        Possible info settings are:

        • title
        • subject
        • author
        • keywords
        • creator

        void setInfo (array|string $info, [string $value = ''])
        • array|string $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.
        • string $value: The value of the setting.
        setLeftMargin (line 652)

        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.

        void setLeftMargin (float $margin)
        • float $margin: The margin.
        setLineWidth (line 1238)

        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.

        void setLineWidth (float $width)
        • float $width: The width.
        setLink (line 1678)

        Defines the page and position a link points to.

        void setLink (integer $link, [float $y = 0], [integer $page = -1])
        • integer $link: The link identifier returned by addLink().
        • float $y: Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page).
        • integer $page: Number of target page; -1 indicates the current page.
        setMargins (line 630)

        Defines the left, top and right margins.

        By default, they equal 1 cm. Call this method to change them.

        void setMargins (float $left, float $top, [float $right = null])
        • float $left: Left margin.
        • float $top: Top margin.
        • float $right: Right margin. If not specified default to the value of the left one.
        setRightMargin (line 681)

        Defines the right margin.

        The method can be called before creating the first page.

        void setRightMargin (float $margin)
        • float $margin: The margin.
        setTextColor (line 1144)

        Sets the text color.

        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.

        void setTextColor (string $cs, float $c1, [float $c2 = 0], [float $c3 = 0], [float $c4 = 0])
        • 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.
        • float $c2: Second color component, floating point value between 0 and 1. Required for rgb and cmyk.
        • float $c3: Third color component, floating point value between 0 and 1. Required for rgb and cmyk.
        • float $c4: Fourth color component, floating point value between 0 and 1. Required for cmyk.
        setTopMargin (line 669)

        Defines the top margin.

        The method can be called before creating the first page.

        void setTopMargin (float $margin)
        • float $margin: The margin.
        setX (line 2430)

        Defines the abscissa of the current position.

        If the passed value is negative, it is relative to the right of the page.

        void setX (float $x)
        • float $x: The value of the abscissa.
        setXY (line 2491)

        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.

        void setXY (float $x, float $y)
        • float $x: The value of the abscissa.
        • float $y: The value of the ordinate.
        setY (line 2468)

        Defines the ordinate of the current position.

        If the passed value is negative, it is relative to the bottom of the page.

        void setY (float $y)
        • float $y: The value of the ordinate.
        text (line 1751)

        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 cell(), multiCell() or write() which are the standard methods to print text.

        All coordinates can be negative to provide values from the right or bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).

        void text (float $x, float $y, string $text)
        • float $x: Abscissa of the origin.
        • float $y: Ordinate of the origin.
        • string $text: String to print.
        write (line 2132)

        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:

        1.  // Begin with regular font
        2.  $pdf->setFont('Arial'''14);
        3.  $pdf->write(5'Visit ');
        4.  // Then put a blue underlined link
        5.  $pdf->setTextColor(00255);
        6.  $pdf->setFont('''U');
        7.  $pdf->write(5'www.fpdf.org''http://www.fpdf.org');

        void write (float $height, string $text, [mixed $link = ''])
        • float $height: Line height.
        • string $text: String to print.
        • mixed $link: URL or identifier returned by addLink().
        writeRotated (line 2239)

        Writes text at an angle.

        All coordinates can be negative to provide values from the right or bottom edge of the page (since File_PDF 0.2.0, Horde 3.2).

        void writeRotated (integer $x, integer $y, string $text, float $text_angle, [float $font_angle = 0])
        • integer $x: X coordinate.
        • integer $y: Y coordinate.
        • string $text: Text to write.
        • float $text_angle: Angle to rotate (Eg. 90 = bottom to top).
        • float $font_angle: Rotate characters as well as text.
        _beginDoc (line 2639)
        void _beginDoc ()
        _beginPage (line 2959)
        void _beginPage ( $orientation)
        • $orientation
        _doUnderline (line 3008)
        void _doUnderline ( $x,  $y,  $text)
        • $x
        • $y
        • $text
        _endDoc (line 2924)
        void _endDoc ()
        _endPage (line 2994)
        void _endPage ()
        _escape (line 3153)
        void _escape ( $s)
        • $s
        _freadInt (line 3137)
        void _freadInt ( $f)
        • $f
        _getFontFile (line 2614)
        void _getFontFile ( $fontkey, [ $path = ''])
        • $fontkey
        • $path
        _link (line 2633)
        void _link ( $x,  $y,  $width,  $height,  $link)
        • $x
        • $y
        • $width
        • $height
        • $link
        _newobj (line 3000)
        void _newobj ()
        _out (line 3168)
        void _out ( $s)
        • $s
        _parseJPG (line 3021)
        void _parseJPG ( $file)
        • $file
        _parsePNG (line 3048)
        void _parsePNG ( $file)
        • $file
        _putCatalog (line 2895)
        void _putCatalog ()
        _putFonts (line 2714)
        void _putFonts ()
        _putImages (line 2804)
        void _putImages ()
        _putInfo (line 2874)
        void _putInfo ()
        _putPages (line 2648)
        void _putPages ()
        _putResources (line 2850)
        void _putResources ()
        _putStream (line 3161)
        void _putStream ( $s)
        • $s
        _putTrailer (line 2917)
        void _putTrailer ()
        _textString (line 3147)
        void _textString ( $s)
        • $s
        _toPt (line 2609)
        void _toPt ( $val)
        • $val

        Documentation generated on Sun, 30 Jan 2011 05:20:21 +0000 by phpDocumentor 1.4.3