Packageindex Classtrees Modulegroups Elementlist Report XML Files

pc4p

pc4p_page

pc4p_page

private class pc4p_page

In this object everything concerning the page is stored. Every page can have its own dimensions, background-images, etc. pp. Most important function in this object, is the ability to move objects from one page to the next, when the current page is full. This is called page-breaking.

AuthorsAlexander Wirtz <alex@pc4p.net>
Version$Id: pc4p_page.html,v 1.19.2.1 2002/08/12 22:47:09 eru Exp $

 

Public Method Summary

void pc4p_set_newpage(mixed $newpage)
Changes the behaviour after a pagebreak
void pc4p_set_margin(mixed $margin)
Sets the margins for the page
integer pc4p_add_bookmark(string $text, [ integer $parent, integer $open ])
Sets a bookmark for this page
void pc4p_set_bgcolor(string $bgcolor)
Sets the background color for this page
void pc4p_set_bgimage(string $imgfile, string $imgtype, [ integer $xoffset, integer $yoffset, float $scale ])
Sets a background image for this page
void pc4p_draw(object pc4p_main &$parent)
Draw-function for the page

Private Method Summary

void pc4p_page(object pc4p_page &$parent, string $format, [ string $orientation, string $dimensions ])
pc4p_page constructor
void pc4p_draw_children()
Draw-children-function for the page
void pc4p_make_pagebreak(object pc4p_main &$parent, integer $position, float $child_height)
Moves the children from a given position onto the next page
void pc4p_calc_offset(object pc4p_main &$parent)
Calculates the offsets in this page for every object contained in it

Public Field Summary

object pc4p_object $header
Header of the page
object pc4p_object $footer
Footer of the page

Private Field Summary

array $children
Array of all children of this object
integer $pdfp
PDF-Pointer used for all pdf_*
object pc4p_main $pdfobj
The main PDF-Object
integer $newpage
Should PC4P always create a new page on pagebreak?
integer $width
Width of the page
integer $height
Height of the page
integer $pagenum
Pagenumber in the PDF
array $margin
Margins for the page
integer $act_x
x-Pos where the page really starts placing objects
integer $act_y
y-Pos where the page really starts placing objects
integer $draw_x
x-Pos used when calculating the positions for the objects
integer $draw_y
y-Pos used when calculating the positions for the objects
array $bookmarks
Bookmarks for this page
string $bg_color
Color of the background
string $bg_image
Name of the background image
string $bgi_type
Type of the background image
float $bgi_xoff
x-Pos for the background image
float $bgi_yoff
y-Pos for the background image
float $bgi_scale
Scale for the background image
float $headerheight
The height of the header, gets saved for following pages
float $footerheight
The height of the footer, gets saved for following pages

Public Method Details

pc4p_set_newpage

public void pc4p_set_newpage(mixed $newpage)

  Sets if a new page after a pagebreak shall be created, or if a already created page shall be used

Parameter
mixed $newpage
Returns void

Author(s) Alexander Wirtz <alex@pc4p.net>

pc4p_set_margin

public void pc4p_set_margin(mixed $margin)

  A Page can have margins to space the objects from the, well, paper-border. The array should look like array( "top" => top, "bottom" => bottom, "left" => left, "right" => right ) or be an integer value

Parameter
mixed $margin
Array containing the margins for the page or an integer to set all margins
Returns void

Author(s) Alexander Wirtz <alex@pc4p.net>

pc4p_add_bookmark

public integer pc4p_add_bookmark(string $text, [ integer $parent, integer $open ])

  This is one of the hypertext-functions of PDF. You can link pages to create a content-overview. If no parent is set, a new root will be created.

Parameter
string $text
Description for the bookmark
integer $parent = >>0<<
Parent node, if $parent == 0 a new root will be created
integer $open = >>1<<
Triggers if the children get folded out
Returns integer $identifier

New node-identifier

Author(s) Alexander Wirtz <alex@pc4p.net>

pc4p_set_bgcolor

public void pc4p_set_bgcolor(string $bgcolor)

  You can define a background color here or reset the color to default, if you don't give a parameter

Parameter
string $bgcolor
You can use one of the 16 standardcolors from HTML or the hex-notation (#rrggbb)
Returns void

See Also pc4p_main::pc4p_check_color()
Author(s) Alexander Wirtz <alex@pc4p.net>

pc4p_set_bgimage

public void pc4p_set_bgimage(string $imgfile, string $imgtype, [ integer $xoffset, integer $yoffset, float $scale ])

  You can define an image, which is used as a background-image for the page. Needed parameters are the image-name, the type of the image (gif, jpg, png, etc. ) and the exact location, where this image shall be placed. The fourth parameter is for scaling the image.

Parameter
string $imgfile
Name of the bg-image
string $imgtype
Type of the bg-image
integer $xoffset = >>0<<
X-offset of the bg-image ( 0
integer $yoffset = >>0<<
Y-offset of the bg-image ( 0
float $scale = >>1<<
Scale of the bg-image
Returns void

Author(s) Alexander Wirtz <alex@pc4p.net>

pc4p_draw

public void pc4p_draw(object pc4p_main &$parent)

  Begins the page with the dimensions, calls the draw for each child and closes the page. Called as last function in the class.

Parameter
object pc4p_main &$parent
Returns void

See Also pc4p_object::pc4p_draw(), pc4p_page::pc4p_draw_children()
Author(s) Alexander Wirtz <alex@pc4p.net>

Private Method Details

pc4p_page

private void pc4p_page(object pc4p_page &$parent, string $format, [ string $orientation, string $dimensions ])

  Checks, if the dimensions for the page is acceptable and sets the PDF-pointer for the page.

Parameter
object pc4p_page &$parent
MUST be a PDF-Object
string $format
Accepts a standard document-format or "user" for customized dimensions
string $orientation = >>"p"<<
Accepts "portrait" ("p") or "landscape" ("l") as parameters, value is ignored, when customized dimensions are used
string $dimensions = >>""<<
If $format is "user", this parameter accepts a WIDTHxHEIGHT notation
Returns void

See Also pc4p_init::&pc4p_create_object(), pc4p_main::pc4p_open_pdf(), pc4p_object::pc4p_set_margin()
Author(s) Alexander Wirtz <alex@pc4p.net>

pc4p_draw_children

private void pc4p_draw_children()

  Calls the draw function for each child in the children-array

Returns void

Author(s) Alexander Wirtz <alex@pc4p.net>

pc4p_make_pagebreak

private void pc4p_make_pagebreak(object pc4p_main &$parent, integer $position, float $child_height)

  Checks if a next page is available and if a move onto this page is allowed. If not, creates a new one. Moves remaining children onto the next page.

Parameter
object pc4p_main &$parent
Parent of this page, must be a PDF-Object
integer $position
Position in the children-array, from which on the children get moved onto the next page
float $child_height
Height of the child at $position
Returns void

See Also pc4p_page::pc4p_set_margin(), pc4p_page::pc4p_set_bgimage(), pc4p_object::pc4p_make_objcopy()
Author(s) Alexander Wirtz <alex@pc4p.net>

pc4p_calc_offset

private void pc4p_calc_offset(object pc4p_main &$parent)

  Calls the calc_offset function in all children. Checks, if the current object still fits onto the page. If not, it checks if there's a following page; if not, it creates one, if yes it uses the existing. Moves the overlapping objects to the new page. In one word: Here's the pagebreak function!!!

Parameter
object pc4p_main &$parent
Parent of this page, must be a PDF-Object
Returns void

See Also pc4p_object::pc4p_set_margin(), pc4p_object::pc4p_calc_offset(), pc4p_page::pc4p_make_pagebreak(), pc4p_table::pc4p_calc_row_offset(), pc4p_table::pc4p_split_table(), pc4p_text::pc4p_calc_offset(), pc4p_text::pc4p_split_text()
Author(s) Alexander Wirtz <alex@pc4p.net>

Public Field Details

$header

public object pc4p_object $header

>><<


$footer

public object pc4p_object $footer

>><<


Private Field Details

$children

private array $children

>>array()<<


$pdfp

private integer $pdfp

>><<


$pdfobj

private object pc4p_main $pdfobj

>><<


$newpage

private integer $newpage

>><<


$width

private integer $width

>><<


$height

private integer $height

>><<


$pagenum

private integer $pagenum

>><<


$margin

private array $margin

>>array( "top" => 5, "bottom" => 5, "left" => 5, "right" => 5 )<<


$act_x

private integer $act_x

>><<


$act_y

private integer $act_y

>><<


$draw_x

private integer $draw_x

>><<


$draw_y

private integer $draw_y

>><<


$bookmarks

private array $bookmarks

>>array()<<


$bg_color

private string $bg_color

>>""<<


$bg_image

private string $bg_image

>><<


$bgi_type

private string $bgi_type

>><<


$bgi_xoff

private float $bgi_xoff

>><<


$bgi_yoff

private float $bgi_yoff

>><<


$bgi_scale

private float $bgi_scale

>><<


$headerheight

private float $headerheight

>><<


$footerheight

private float $footerheight

>><<



Packageindex Classtrees Modulegroups Elementlist Report XML Files
Generated on Tue, 13 Aug 2002 00:43:10 +0200 by PHPDoc v1.5 www.phpdoc.de