Contentserv PHP API

CSSmartPage
in package

Represents a Smart Document Page(-flow) that can be added to a CSSmartDocument To create a new SmartDocumentPage use @see CSSmartDocument::addPage()

Tags
since

CS14.0

access

public

Table of Contents

__construct()  : mixed
This constructor should not be used, use instead @see CSSmartDocument::addPage() instead
addBookmark()  : void
Adds a bookmark to the html content of the page that can be used for the index creation and document navigation
addHtml()  : void
Adds another html content snippet to the page
addMacro()  : mixed
Temporary method, not yet supported
addText()  : void
Adds another text content snippet to the page
continuesSetupFromLastPage()  : mixed
doContinueSetupFromLastPage()  : void
Sets the page to continue the page settings of the previous page
getBackgroundColor()  : string
Returns the background color of the whole page if set
getBackgroundImage()  : array<string|int, mixed>
Returns the background definition if any
getContentHtml()  : array<string|int, string>
Returns the html content snippets that have been added to this page
getCSSStyle()  : mixed
getFooterContent()  : string
getFooterCSSStyle()  : mixed
getFormat()  : string
Gets the format of the document
getHeaderContent()  : string
getHeaderCSSStyle()  : mixed
getOrientation()  : string
Gets the orientation (portrait or landscape) of the document
getPaddingBottom()  : float
Gets the bottom padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.
getPaddingLeft()  : float
Gets the left padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.
getPaddingRight()  : float
Gets the right padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.
getPaddingTop()  : float
Gets the top padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.
getPageNumber()  : string
Returns the token to generate a page number at pdf rendering time This token can be added as HTML content and will be replaced later by the actual real page number
getWatermarkImageWidthHeight()  : array<string|int, mixed>
returns the array of width and height in pixel of the image according to the page format .
insertHtml()  : mixed
Inserts an html content snippet before or after another one
keepTogetherEnd()  : void
Adds a token to the html output of the page, that will mark a keep-together area end A keep-together area will not be split over two pages, so when one part of it does not fit on the current page, then the whole area will be moved to the next page
keepTogetherStart()  : void
Adds a token to the html output of the page, that will mark a keep-together area start A keep-together area will not be split over two pages, so when one part of it does not fit on the current page, then the whole area will be moved to the next page
makeHtml()  : string
This methods accumulates all collected html fragments of this page to one html string optimized for display in a browser
replaceHtml()  : mixed
Replaces an html content snippet by another one
setBackgroundColor()  : void
Set's the background color of the whole page
setBackgroundImage()  : mixed
Sets a background image for a page
setContentHtml()  : mixed
Replaces all html content added by the passed $html string
setCSSStyle()  : void
Defines a css string that should be valid for the whole page
setFooterContent()  : void
setFooterCSSStyle()  : void
Defines a css string that should be valid for the footer area
setFormat()  : void
Overwrites the format of the document
setHeaderContent()  : void
setHeaderCSSStyle()  : void
Defines a css string that should be valid for the header area
setOrientation()  : void
Sets the orientation (portrait or landscape) of the document
setOrientationToLandscape()  : void
Sets the orientation of the document to landscape
setOrientationToPortrait()  : void
Sets the orientation of the document to portrait
setPadding()  : void
Sets the inner padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.
setPaddingBottom()  : void
Sets the bottom padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.
setPaddingLeft()  : void
Sets the left padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.
setPaddingRight()  : void
Sets the right padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.
setPaddingTop()  : void
Sets the top padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

Methods

__construct()

This constructor should not be used, use instead @see CSSmartDocument::addPage() instead

public __construct(mixed $document[, mixed $html = '' ][, mixed $headerContent = '' ][, mixed $footerContent = '' ]) : mixed
Parameters
$document : mixed
$html : mixed = ''
$headerContent : mixed = ''
$footerContent : mixed = ''
Tags
ignored
Return values
mixed

addBookmark()

Adds a bookmark to the html content of the page that can be used for the index creation and document navigation

public addBookmark(string $title, int $level) : void
Parameters
$title : string

the title of the bookmark

$level : int

the level of the bookmark, starting from 0 (Root Level)

Tags
access

public

Return values
void

addHtml()

Adds another html content snippet to the page

public addHtml(string $html[, string $key = FALSE ]) : void
Parameters
$html : string

html code that should be rendered in the document, can contain also classes referring to the css of the document, make sure that html entities are encoded properly

$key : string = FALSE

an optional storage key, that can be used to identify the html later by template developers and to overwrite it

Tags
access

public

Return values
void

addText()

Adds another text content snippet to the page

public addText(string $text[, string $key = FALSE ]) : void
Parameters
$text : string

text that should be rendered in the document

$key : string = FALSE

an optional storage key, that can be used to identify the html later by template developers and to overwrite it

Tags
access

public

Return values
void

continuesSetupFromLastPage()

public continuesSetupFromLastPage() : mixed
Tags
Return values
mixed

doContinueSetupFromLastPage()

Sets the page to continue the page settings of the previous page

public doContinueSetupFromLastPage([bool $continue = TRUE ]) : void
Parameters
$continue : bool = TRUE

yes if the page should continue

Tags
access

public

Return values
void

getBackgroundColor()

Returns the background color of the whole page if set

public getBackgroundColor() : string
Tags
access

public

Return values
string

the background color of the page

getBackgroundImage()

Returns the background definition if any

public getBackgroundImage() : array<string|int, mixed>
Tags
access

public

Return values
array<string|int, mixed>

with background image information

getContentHtml()

Returns the html content snippets that have been added to this page

public getContentHtml() : array<string|int, string>
Tags
Return values
array<string|int, string>

html snippets that have been added

getCSSStyle()

public getCSSStyle() : mixed
Tags
Return values
mixed

getFooterContent()

public getFooterContent() : string
Tags
access

public

Return values
string

the current footer html content defined

getFooterCSSStyle()

public getFooterCSSStyle() : mixed
Tags
Return values
mixed

getFormat()

Gets the format of the document

public getFormat() : string
Tags
see
setFormat()
access

public

Return values
string

the format

getHeaderContent()

public getHeaderContent() : string
Tags
access

public

Return values
string

the current header html content defined

getHeaderCSSStyle()

public getHeaderCSSStyle() : mixed
Tags
Return values
mixed

getOrientation()

Gets the orientation (portrait or landscape) of the document

public getOrientation() : string
Tags
access

public

Return values
string

$orientation one of the CSSmart orientation constants

getPaddingBottom()

Gets the bottom padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

public getPaddingBottom([mixed $withUnits = TRUE ]) : float
Parameters
$withUnits : mixed = TRUE
Tags
access

public

Return values
float

the bottom padding

getPaddingLeft()

Gets the left padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

public getPaddingLeft([mixed $withUnits = TRUE ]) : float
Parameters
$withUnits : mixed = TRUE
Tags
access

public

Return values
float

the left padding

getPaddingRight()

Gets the right padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

public getPaddingRight([mixed $withUnits = TRUE ]) : float
Parameters
$withUnits : mixed = TRUE
Tags
access

public

Return values
float

the right padding

getPaddingTop()

Gets the top padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

public getPaddingTop([mixed $withUnits = TRUE ]) : float
Parameters
$withUnits : mixed = TRUE
Tags
access

public

Return values
float

the top padding

getPageNumber()

Returns the token to generate a page number at pdf rendering time This token can be added as HTML content and will be replaced later by the actual real page number

public static getPageNumber() : string
Tags
access

public

Return values
string

the token

getWatermarkImageWidthHeight()

returns the array of width and height in pixel of the image according to the page format .

public getWatermarkImageWidthHeight(string $watermark) : array<string|int, mixed>
Parameters
$watermark : string

the watermark image path.

Tags
access

public

Return values
array<string|int, mixed>

of width and height in pixel.

insertHtml()

Inserts an html content snippet before or after another one

public insertHtml(string $html, string $targetKey[, bool $insertBefore = TRUE ]) : mixed
Parameters
$html : string

html code that should be inserted to the other html snippets in the page, can contain also classes referring to the css of the document

$targetKey : string

storage key

$insertBefore : bool = TRUE

if the new html snippet should be inserted before or after the targetKey

Tags
access

public

Return values
mixed

keepTogetherEnd()

Adds a token to the html output of the page, that will mark a keep-together area end A keep-together area will not be split over two pages, so when one part of it does not fit on the current page, then the whole area will be moved to the next page

public keepTogetherEnd() : void
Tags
access

public

Return values
void

keepTogetherStart()

Adds a token to the html output of the page, that will mark a keep-together area start A keep-together area will not be split over two pages, so when one part of it does not fit on the current page, then the whole area will be moved to the next page

public keepTogetherStart() : void
Tags
access

public

Return values
void

makeHtml()

This methods accumulates all collected html fragments of this page to one html string optimized for display in a browser

public makeHtml(mixed $sHeaderHtml, mixed $sFooterHtml) : string
Parameters
$sHeaderHtml : mixed
$sFooterHtml : mixed
Tags
access

public

Return values
string

with the complete html output of the page including header and footer

replaceHtml()

Replaces an html content snippet by another one

public replaceHtml(string $html, string $key) : mixed
Parameters
$html : string

html code that should be rendered in the document, can contain also classes referring to the css of the document

$key : string

storage key, that can be replaced

Tags
access

public

Return values
mixed

setBackgroundColor()

Set's the background color of the whole page

public setBackgroundColor(string $color) : void
Parameters
$color : string

background color as hex value, like #339966

Tags
access

public

Return values
void

setBackgroundImage()

Sets a background image for a page

public setBackgroundImage(string $link, int $positionX, int $positionY[, string $width = '100%' ]) : mixed
Parameters
$link : string

the link to the background image

$positionX : int

the vertical position in mm

$positionY : int

the horizontal position in mm

$width : string = '100%'

the scaling width of the background image

Tags
Return values
mixed

setContentHtml()

Replaces all html content added by the passed $html string

public setContentHtml(string $html[, bool $key = FALSE ]) : mixed
Parameters
$html : string

html code that should be rendered in the document, can contain also classes refering to the css of the document

$key : bool = FALSE

an optional storage key, that can be used to identify the html later by template developers and to overwrite it

Tags
Return values
mixed

setCSSStyle()

Defines a css string that should be valid for the whole page

public setCSSStyle(mixed $style) : void
Parameters
$style : mixed
Tags
access

public

Return values
void

setFooterContent()

public setFooterContent(string $footerContent) : void
Parameters
$footerContent : string

the new footer html content

Tags
access

public

Return values
void

setFooterCSSStyle()

Defines a css string that should be valid for the footer area

public setFooterCSSStyle(mixed $style) : void
Parameters
$style : mixed
Tags
access

public

Return values
void

setFormat()

Overwrites the format of the document

public setFormat(mixed $format) : void
Parameters
$format : mixed

The format used for pages. It can be either one of the following values (case insensitive) or a custom format in the form of a two-element array containing the width and the height in mm

  • 4A0
  • 2A0
  • A0
  • A1
  • A2
  • A3
  • A4 (default)
  • A5
  • A6
  • A7
  • A8
  • A9
  • A10
  • B0
  • B1
  • B2
  • B3
  • B4
  • B5
  • B6
  • B7
  • B8
  • B9
  • B10
  • C0
  • C1
  • C2
  • C3
  • C4
  • C5
  • C6
  • C7
  • C8
  • C9
  • C10
  • RA0
  • RA1
  • RA2
  • RA3
  • RA4
  • SRA0
  • SRA1
  • SRA2
  • SRA3
  • SRA4
  • LETTER
  • LEGAL
  • EXECUTIVE
  • FOLIO
Tags
access

public

Return values
void

setHeaderContent()

public setHeaderContent(string $headerContent) : void
Parameters
$headerContent : string

the new header html content

Tags
access

public

Return values
void

setHeaderCSSStyle()

Defines a css string that should be valid for the header area

public setHeaderCSSStyle(mixed $style) : void
Parameters
$style : mixed
Tags
access

public

Return values
void

setOrientation()

Sets the orientation (portrait or landscape) of the document

public setOrientation(string $orientation) : void
Parameters
$orientation : string

one of the CSSmart orientation constants

Tags
access

public

Return values
void

setOrientationToLandscape()

Sets the orientation of the document to landscape

public setOrientationToLandscape() : void
Tags
access

public

Return values
void

setOrientationToPortrait()

Sets the orientation of the document to portrait

public setOrientationToPortrait() : void
Tags
access

public

Return values
void

setPadding()

Sets the inner padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

public setPadding(float $topOrAll[, float $right = NULL ][, float $bottom = NULL ][, float $left = NULL ]) : void
Parameters
$topOrAll : float

the top padding in mm, if top is the only value provided all paddings are set to top

$right : float = NULL

the right padding in mm

$bottom : float = NULL

the bottom padding in mm

$left : float = NULL

the left padding in mm

Tags
access

public

Return values
void

setPaddingBottom()

Sets the bottom padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

public setPaddingBottom(float $padding) : void
Parameters
$padding : float

the bottom padding

Tags
access

public

Return values
void

setPaddingLeft()

Sets the left padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

public setPaddingLeft(float $padding) : void
Parameters
$padding : float

the left padding

Tags
access

public

Return values
void

setPaddingRight()

Sets the right padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

public setPaddingRight(float $padding) : void
Parameters
$padding : float

the right padding

Tags
access

public

Return values
void

setPaddingTop()

Sets the top padding of the page The content of a page is written to the content area, which is surrounded by the document margin and the page padding. The padding will only affect the inner content area, while the header and footer are placed at the margins.

public setPaddingTop(float $padding) : void
Parameters
$padding : float

the top padding

Tags
access

public

Return values
void

        

Search results