Documentation

Page extends AbstractFrameDecorator
in package

Decorates frames for page layout

Tags
access

private

Table of Contents

DEFAULT_COUNTER  = "-dompdf-default-counter"
WS_SPACE  = 2
WS_TEXT  = 1
$_already_pushed  : bool
Tells whether the frame was already pushed to the next page
$_counters  : mixed
$_float_next_line  : bool
$_splitted  : bool
Tells whether the frame was split
$_ws_state  : int
$ID_COUNTER  : mixed
Unique id counter
$_bottom_page_margin  : float
y value of bottom page margin
$_containing_block  : array<string|int, float>
This frame's containing block (used in layout): array(x, y, w, h)
$_containing_line  : LineBox
This frame's containing line box
$_decorator  : AbstractFrameDecorator
This frame's decorator
$_dompdf  : Dompdf
Reference to the current dompdf instance
$_first_child  : Frame
This frame's first child. All children are handled as a doubly-linked list.
$_floating_frames  : array<string|int, mixed>
This page's floating frames
$_frame  : Frame
The decorated frame
$_frame_list  : array<string|int, Frame>
This frame's children
$_id  : string
Unique identifier for this frame. Used to reference this frame via the node.
$_in_table  : int
Number of tables currently being reflowed
$_is_cache  : array<string|int, mixed>
$_last_child  : Frame
This frame's last child.
$_next_sibling  : Frame
This frame's next sibling in the document tree.
$_node  : DOMElement|DOMText
The DOMElement or DOMText object this frame represents
$_opacity  : float
Absolute opacity of this frame
$_original_style  : Style
This frame's original style. Needed for cases where frames are split across pages.
$_page_full  : bool
Flag indicating page is full.
$_parent  : Frame
This frame's parent in the document tree.
$_position  : array<string|int, float>
Position on the page of the top-left corner of the margin box of this frame: array(x,y)
$_positioner  : AbstractPositioner
AbstractPositioner object used to position this frame (Strategy pattern)
$_prev_sibling  : Frame
This frame's previous sibling in the document tree.
$_reflower  : AbstractFrameReflower
Reflower object used to calculate frame dimensions (Strategy pattern)
$_renderer  : Renderer
The pdf renderer
$_root  : Frame
The root node of the DOM tree
$_style  : Style
This frame's calculated style
$_block_parent  : Block
First block parent
$_cached_parent  : Frame
Cache for the get_parent while loop results
$_positionned_parent  : AbstractFrameDecorator
First positionned parent (position: relative | absolute | fixed)
__construct()  : mixed
Class constructor
__toString()  : string
add_floating_frame()  : void
Add a floating frame
append_child()  : mixed
Inserts a new child at the end of the Frame
calculate_auto_width()  : float
Determine current frame width based on contents
check_forced_page_break()  : bool
Check if a forced page break is required before $frame. This uses the frame's page_break_before property as well as the preceeding frame's page_break_after property.
check_page_break()  : bool
Check if $frame will fit on the page. If the frame does not fit, the frame tree is modified so that a page break occurs in the correct location.
copy()  : Frame
Return a copy of this frame with $node as its node
counter_value()  : bool|string
decrement_counters()  : mixed
deep_copy()  : Frame
Create a deep copy: copy this node and all children
dispose()  : mixed
"Destructor": forcibly free all references held by this frame
find_block_parent()  : Block
find_positionned_parent()  : AbstractFrameDecorator
get_border_box()  : array<string|int, mixed>
Return the border box of the frame
get_break_margins()  : float
get_children()  : FrameList|array<string|int, Frame>
get_containing_block()  : array<string|int, float>|float
Containing block dimensions
get_containing_line()  : LineBox
get_content_box()  : array<string|int, mixed>
Return the content box (x,y,w,h) of the frame
get_decorator()  : AbstractFrameDecorator
get_dompdf()  : Dompdf
get_first_child()  : Frame
get_floating_frames()  : array<string|int, Frame>
get_frame()  : Frame
get_id()  : string
get_last_child()  : Frame
get_lowest_float_offset()  : int|mixed
get_margin_height()  : float
Return the height of the margin box of the frame, in pt. Meaningless unless the height has been calculated properly.
get_margin_width()  : float
Return the width of the margin box of the frame, in pt. Meaningless unless the width has been calculated properly.
get_min_max_width()  : array<string|int, mixed>
get_next_sibling()  : Frame
get_node()  : DOMElement|DOMText
get_opacity()  : float
get_original_style()  : Style
get_padding_box()  : array<string|int, mixed>
Return the padding box (x,y,w,h) of the frame
get_parent()  : Frame
get_position()  : array<string|int, mixed>|float
Block position
get_prev_sibling()  : Frame
get_reflower()  : AbstractFrameReflower
get_renderer()  : Renderer
Return the renderer used for this pdf
get_root()  : Page
get_style()  : Style
get_subtree()  : FrameTreeList
in_nested_table()  : bool
Return whether we are currently in a nested table or not
increment_counter()  : mixed
increment_counters()  : mixed
insert_child_after()  : mixed
Inserts a new child immediately after the specified frame
insert_child_before()  : mixed
Inserts a new child immediately before the specified frame
is_absolute()  : bool
is_auto_height()  : bool
Indicates if the margin height is auto sized
is_auto_width()  : bool
Indicates if the margin width is auto sized
is_block()  : bool
is_full()  : bool
Returns true if the page is full and is no longer accepting frames.
is_in_flow()  : bool
is_inline_block()  : bool
is_positionned()  : bool
is_pre()  : bool
is_table()  : bool
is_text_node()  : bool
Tells if the frame is a text node
lookup_counter_frame()  : AbstractFrameDecorator|null
move()  : mixed
next_page()  : mixed
Start a new page by resetting the full flag.
position()  : mixed
prepend_child()  : mixed
Inserts a new child at the beginning of the Frame
reflow()  : mixed
remove_child()  : Frame
Remove a child frame
remove_floating_frame()  : mixed
reset()  : mixed
Re-initialize the frame
reset_counter()  : mixed
set_containing_block()  : mixed
Set the frame's containing block. Overridden to set $this->_bottom_page_margin.
set_containing_line()  : mixed
set_decorator()  : mixed
set_id()  : mixed
set_opacity()  : mixed
set_position()  : mixed
set_positioner()  : mixed
set_reflower()  : mixed
set_renderer()  : mixed
Set the renderer used for this pdf
set_root()  : mixed
set_style()  : mixed
split()  : void
split this frame at $child.
table_reflow_end()  : mixed
Indicate to the page that table reflow is finished.
table_reflow_start()  : mixed
Indicate to the page that a table is currently being reflowed.
_page_break_allowed()  : bool
Determine if a page break is allowed before $frame http://www.w3.org/TR/CSS21/page.html#allowed-page-breaks
ws_is_text()  : bool
ws_keep()  : bool
ws_trim()  : mixed
WIP : preprocessing to remove all the unused whitespace

Constants

WS_SPACE

public mixed WS_SPACE = 2

WS_TEXT

public mixed WS_TEXT = 1

Properties

$_already_pushed

Tells whether the frame was already pushed to the next page

public bool $_already_pushed = false

$_float_next_line

public bool $_float_next_line = false

$_splitted

Tells whether the frame was split

public bool $_splitted

$_ws_state

public static int $_ws_state = self::WS_SPACE

$ID_COUNTER

Unique id counter

public static mixed $ID_COUNTER = 0

$_bottom_page_margin

y value of bottom page margin

protected float $_bottom_page_margin

$_containing_block

This frame's containing block (used in layout): array(x, y, w, h)

protected array<string|int, float> $_containing_block

$_containing_line

This frame's containing line box

protected LineBox $_containing_line

$_first_child

This frame's first child. All children are handled as a doubly-linked list.

protected Frame $_first_child

$_floating_frames

This page's floating frames

protected array<string|int, mixed> $_floating_frames = []

$_frame_list

This frame's children

protected array<string|int, Frame> $_frame_list

$_id

Unique identifier for this frame. Used to reference this frame via the node.

protected string $_id

$_in_table

Number of tables currently being reflowed

protected int $_in_table

$_is_cache

protected array<string|int, mixed> $_is_cache = []

$_last_child

This frame's last child.

protected Frame $_last_child

$_next_sibling

This frame's next sibling in the document tree.

protected Frame $_next_sibling

$_node

The DOMElement or DOMText object this frame represents

protected DOMElement|DOMText $_node

$_opacity

Absolute opacity of this frame

protected float $_opacity

$_original_style

This frame's original style. Needed for cases where frames are split across pages.

protected Style $_original_style

$_page_full

Flag indicating page is full.

protected bool $_page_full

$_parent

This frame's parent in the document tree.

protected Frame $_parent

$_position

Position on the page of the top-left corner of the margin box of this frame: array(x,y)

protected array<string|int, float> $_position

$_prev_sibling

This frame's previous sibling in the document tree.

protected Frame $_prev_sibling

$_style

This frame's calculated style

protected Style $_style

Methods

__construct()

Class constructor

public __construct(Frame $frame, Dompdf $dompdf) : mixed
Parameters
$frame : Frame

the frame to decorate

$dompdf : Dompdf
Return values
mixed

__toString()

public __toString() : string
Return values
string

add_floating_frame()

Add a floating frame

public add_floating_frame(Frame $frame) : void
Parameters
$frame : Frame
Return values
void

append_child()

Inserts a new child at the end of the Frame

public append_child( $child[,  $update_node = true ]) : mixed
Parameters
$child :

Frame The new Frame to insert

$update_node : = true

boolean Whether or not to update the DOM

Return values
mixed

calculate_auto_width()

Determine current frame width based on contents

public final calculate_auto_width() : float
Return values
float

check_forced_page_break()

Check if a forced page break is required before $frame. This uses the frame's page_break_before property as well as the preceeding frame's page_break_after property.

public check_forced_page_break(Frame $frame) : bool
Parameters
$frame : Frame

the frame to check

Tags
link
http://www.w3.org/TR/CSS21/page.html#forced
Return values
bool

true if a page break occured

check_page_break()

Check if $frame will fit on the page. If the frame does not fit, the frame tree is modified so that a page break occurs in the correct location.

public check_page_break(Frame $frame) : bool
Parameters
$frame : Frame

the frame to check

Return values
bool

counter_value()

public counter_value([string $id = self::DEFAULT_COUNTER ][, string $type = "decimal" ]) : bool|string
Parameters
$id : string = self::DEFAULT_COUNTER
$type : string = "decimal"
Return values
bool|string

TODO: What version is the best : this one or the one in ListBullet ?

decrement_counters()

public decrement_counters( $counters) : mixed
Parameters
$counters :
Return values
mixed

dispose()

"Destructor": forcibly free all references held by this frame

public dispose([bool $recursive = false ]) : mixed
Parameters
$recursive : bool = false

if true, call dispose on all children

Return values
mixed

get_border_box()

Return the border box of the frame

public get_border_box() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_break_margins()

public get_break_margins() : float
Return values
float

get_containing_block()

Containing block dimensions

public get_containing_block([ $i = null ]) : array<string|int, float>|float
Parameters
$i : = null

string The key of the wanted containing block's dimension (x, y, w, h)

Return values
array<string|int, float>|float

get_content_box()

Return the content box (x,y,w,h) of the frame

public get_content_box() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_floating_frames()

public get_floating_frames() : array<string|int, Frame>
Return values
array<string|int, Frame>

get_id()

public get_id() : string
Return values
string

get_lowest_float_offset()

public get_lowest_float_offset(Frame $child) : int|mixed
Parameters
$child : Frame
Return values
int|mixed

get_margin_height()

Return the height of the margin box of the frame, in pt. Meaningless unless the height has been calculated properly.

public get_margin_height() : float
Return values
float

get_margin_width()

Return the width of the margin box of the frame, in pt. Meaningless unless the width has been calculated properly.

public get_margin_width() : float
Return values
float

get_min_max_width()

public final get_min_max_width() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_node()

public get_node() : DOMElement|DOMText
Return values
DOMElement|DOMText

get_opacity()

public get_opacity([null $opacity = null ]) : float
Parameters
$opacity : null = null
Return values
float

get_original_style()

public get_original_style() : Style
Return values
Style

get_padding_box()

Return the padding box (x,y,w,h) of the frame

public get_padding_box() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_position()

Block position

public get_position([ $i = null ]) : array<string|int, mixed>|float
Parameters
$i : = null

string The key of the wanted position value (x, y)

Return values
array<string|int, mixed>|float

get_renderer()

Return the renderer used for this pdf

public get_renderer() : Renderer
Return values
Renderer

in_nested_table()

Return whether we are currently in a nested table or not

public in_nested_table() : bool
Return values
bool

increment_counter()

public increment_counter([string $id = self::DEFAULT_COUNTER ][, int $increment = 1 ]) : mixed
Parameters
$id : string = self::DEFAULT_COUNTER
$increment : int = 1
Return values
mixed

increment_counters()

public increment_counters( $counters) : mixed
Parameters
$counters :
Return values
mixed

insert_child_after()

Inserts a new child immediately after the specified frame

public insert_child_after( $new_child,  $ref[,  $update_node = true ]) : mixed
Parameters
$new_child :

Frame The new Frame to insert

$ref :

Frame The Frame before the new Frame

$update_node : = true

boolean Whether or not to update the DOM

Tags
throws
Exception
Return values
mixed

insert_child_before()

Inserts a new child immediately before the specified frame

public insert_child_before( $new_child,  $ref[,  $update_node = true ]) : mixed
Parameters
$new_child :

Frame The new Frame to insert

$ref :

Frame The Frame after the new Frame

$update_node : = true

boolean Whether or not to update the DOM

Tags
throws
Exception
Return values
mixed

is_absolute()

public is_absolute() : bool
Return values
bool

is_auto_height()

Indicates if the margin height is auto sized

public is_auto_height() : bool
Return values
bool

is_auto_width()

Indicates if the margin width is auto sized

public is_auto_width() : bool
Return values
bool

is_block()

public is_block() : bool
Return values
bool

is_full()

Returns true if the page is full and is no longer accepting frames.

public is_full() : bool
Return values
bool

is_in_flow()

public is_in_flow() : bool
Return values
bool

is_inline_block()

public is_inline_block() : bool
Return values
bool

is_positionned()

public is_positionned() : bool
Return values
bool

is_pre()

public is_pre() : bool
Return values
bool

is_table()

public is_table() : bool
Return values
bool

is_text_node()

Tells if the frame is a text node

public is_text_node() : bool
Return values
bool

move()

public final move( $offset_x,  $offset_y[, bool $ignore_self = false ]) : mixed
Parameters
$offset_x :
$offset_y :
$ignore_self : bool = false
Return values
mixed

next_page()

Start a new page by resetting the full flag.

public next_page() : mixed
Return values
mixed

prepend_child()

Inserts a new child at the beginning of the Frame

public prepend_child( $child[,  $update_node = true ]) : mixed
Parameters
$child :

Frame The new Frame to insert

$update_node : = true

boolean Whether or not to update the DOM

Return values
mixed

remove_child()

Remove a child frame

public remove_child(Frame $child[, bool $update_node = true ]) : Frame
Parameters
$child : Frame
$update_node : bool = true

Whether or not to remove the DOM node

Tags
throws
Exception
Return values
Frame

The removed child frame

remove_floating_frame()

public remove_floating_frame( $key) : mixed
Parameters
$key :
Return values
mixed

reset()

Re-initialize the frame

public reset() : mixed
Return values
mixed

reset_counter()

public reset_counter([string $id = self::DEFAULT_COUNTER ], int $value) : mixed
Parameters
$id : string = self::DEFAULT_COUNTER
$value : int
Return values
mixed

set_containing_block()

Set the frame's containing block. Overridden to set $this->_bottom_page_margin.

public set_containing_block([float $x = null ][, float $y = null ][, float $w = null ][, float $h = null ]) : mixed
Parameters
$x : float = null
$y : float = null
$w : float = null
$h : float = null
Return values
mixed

set_containing_line()

public set_containing_line(LineBox $line) : mixed
Parameters
$line : LineBox
Return values
mixed

set_id()

public set_id( $id) : mixed
Parameters
$id :
Return values
mixed

set_opacity()

public set_opacity( $opacity) : mixed
Parameters
$opacity :
Return values
mixed

set_position()

public set_position([null $x = null ][, null $y = null ]) : mixed
Parameters
$x : null = null
$y : null = null
Return values
mixed

set_renderer()

Set the renderer used for this pdf

public set_renderer(Renderer $renderer) : mixed
Parameters
$renderer : Renderer

the renderer to use

Return values
mixed

set_style()

public set_style(Style $style) : mixed
Parameters
$style : Style
Return values
mixed

split()

split this frame at $child.

public split([Frame|null $frame = null ][, bool $force_pagebreak = false ]) : void
Parameters
$frame : Frame|null = null
$force_pagebreak : bool = false
Return values
void

table_reflow_end()

Indicate to the page that table reflow is finished.

public table_reflow_end() : mixed
Return values
mixed

table_reflow_start()

Indicate to the page that a table is currently being reflowed.

public table_reflow_start() : mixed
Return values
mixed

_page_break_allowed()

Determine if a page break is allowed before $frame http://www.w3.org/TR/CSS21/page.html#allowed-page-breaks

protected _page_break_allowed(Frame $frame) : bool

In the normal flow, page breaks can occur at the following places:

  1. In the vertical margin between block boxes. When a page break occurs here, the used values of the relevant 'margin-top' and 'margin-bottom' properties are set to '0'.
  2. Between line boxes inside a block box.
  3. Between the content edge of a block container box and the outer edges of its child content (margin edges of block-level children or line box edges for inline-level children) if there is a (non-zero) gap between them.

These breaks are subject to the following rules:

  • Rule A: Breaking at (1) is allowed only if the 'page-break-after' and 'page-break-before' properties of all the elements generating boxes that meet at this margin allow it, which is when at least one of them has the value 'always', 'left', or 'right', or when all of them are 'auto'.

  • Rule B: However, if all of them are 'auto' and the nearest common ancestor of all the elements has a 'page-break-inside' value of 'avoid', then breaking here is not allowed.

  • Rule C: Breaking at (2) is allowed only if the number of line boxes between the break and the start of the enclosing block box is the value of 'orphans' or more, and the number of line boxes between the break and the end of the box is the value of 'widows' or more.

  • Rule D: In addition, breaking at (2) is allowed only if the 'page-break-inside' property is 'auto'.

If the above doesn't provide enough break points to keep content from overflowing the page boxes, then rules B and D are dropped in order to find additional breakpoints.

If that still does not lead to sufficient break points, rules A and C are dropped as well, to find still more break points.

We will also allow breaks between table rows. However, when splitting a table, the table headers should carry over to the next page (but they don't yet).

Parameters
$frame : Frame

the frame to check

Return values
bool

true if a break is allowed, false otherwise

ws_is_text()

protected ws_is_text() : bool
Return values
bool

ws_keep()

protected ws_keep() : bool
Return values
bool

ws_trim()

WIP : preprocessing to remove all the unused whitespace

protected ws_trim() : mixed
Return values
mixed

Search results