Contentserv PHP API

CSSmartTemplate extends CSSmartDocument
in package

A Template for a CSSmartDocument that allows a CSSmartTemplatePlugin to predefine a document Such a template then can be overwritten partially by the method @link overwriteHtml.

Tags
since

CS14.0

access

public

Table of Contents

__construct()  : CSSmartTemplate
The constructor is normally not directly invoked. Instead use the method @link CSSmart::createTemplate
addCSSCode()  : void
Adds CSS Code to the Document that is applied to all pages
addCSSLink()  : void
Adds CSS Code in a css file to the document that is applied to all pages
addFontFile()  : mixed
Adds a ttf font file to be used in the PDF
addIndex()  : void
Displays an index collecting all defined bookmarks
addJSCode()  : void
Adds JS Code to the Document that is applied to all pages
addJSLink()  : void
Adds JS Code in a js file to the document that is applied to all pages
addPage()  : CSSmartPage
Adds another page(-flow) to the document that can be modified and filled with html content afterwards
calculateOrientation()  : string
Finds out if the document width and height ratio is Landscape or Portrait
collectHtml()  : array<string|int, mixed>
This methods accumulates all html fragments of the pages and the document css to one array
convertOTFFont()  : bool|string
Converts an Open Type Font to an True Type Font.
convertTTCFont()  : array<string|int, mixed>|bool
Converts a True Type Collection to single True Type Fonts.
createRenderer()  : CSSmartRendererPlugin
Creates a CSSmartRendererPlugin which can be used to render the pdf for this document Normally it is not required to create your own renderer. Instead a renderer is created on the fly as soon you call up the methods @link makePdf or @link streamPdf.
drawPageBox()  : mixed
Enlarges or shrinks the type of boxes by the values of the document in all directions
drawPrinterMarks()  : mixed
Enlarges the MediaBox by the slug of the document in all directions and draws cropmarks, registrations marks and color bars
finalize()  : void
This method will be called by the renderer once the internal tcpdf object has been created and the html output was placed. It is the final hook to deal with the extended api of the tcpdf object and passes this hook on to the template plugin
getAdminPassword()  : string
getArtBox()  : mixed
Tells if the final document should be rendered with ArtBox
getBleedBox()  : mixed
Tells if the final document should be rendered with BleedBox
getBoxValues()  : array<string|int, mixed>
Gets the tcpdf coordinates for a (default, enlarged or shrunk) PDF box.
getCreationDate()  : mixed
Gets the creation date for the original creation time
getCreationPreset()  : CSSmartPreset
Gets the creation preset used for the original creation
getCreationTemplate()  : string
Gets the creation template name used for the original creation
getCreationUserID()  : mixed
Gets the ID of the user that originally created the document
getCSS()  : array<string|int, string>
Returns the complete css code for the document
getCSSHead()  : string
Compiles the CSS Links & Snippets to a text that can be embedded into a HTML Head Element
getDisplayMode()  : string
Gets the way how a viewer should display the document, e.g. with thumbs or with tree navigation
getEncoding()  : string
Defines the encoding of the document content
getFile()  : CSMamFile
Returns the file for the document
getFirstPageFooter()  : string
getFirstPageHeader()  : string
getFontFiles()  : array<string|int, mixed>
Retrieve the additional fonts defined for this document
getFontName()  : mixed
This method converts the file base name of an ttf font to the internal name used by tcpdf. this needs to be done to use the same font names in css and tcpdf.
getFormat()  : string
Gets the format of the document
getIndices()  : array<string|int, mixed>
getJS()  : array<string|int, string>
Returns the complete js code for the document
getJSHead()  : string
Compiles the JS Links & Snippets to a text that can be embedded into a HTML Head Element
getLayout()  : string
Gets the layout in which a viewer should display the document
getLeftPageFooter()  : string
getLeftPageHeader()  : string
getMarginBottom()  : string
Returns the bottom margin of the document
getMarginLeft()  : string
Returns the left margin of the document
getMarginRight()  : string
Returns the right margin of the document
getMarginTop()  : string
Returns the top margin of the document
getMediaBox()  : mixed
Tells if the final document should be rendered with MediaBox
getMetaAuthor()  : string
Sets the Author Property which is for example seen in the Adobe Readers Properties Dialog
getMetaConformance()  : void
Returns the Conformance Property which is used to decide format of pdf generated by pdfreactor.
getMetaKeywords()  : string
Sets the Keywords Property which is for example seen in the Adobe Readers Properties Dialog
getMetaSubject()  : string
Returns the Subject Property which is for example seen in the Adobe Readers Properties Dialog
getMetaTitle()  : string
Returns the Title Property which is for example seen in the Adobe Readers Properties Dialog
getMetaVersion()  : void
Returns the Version Property which is for example seen in the Adobe Readers Properties Dialog
getNumberOfPages()  : int
getOrientation()  : string
Gets the orientation (portrait or landscape) of the document
getPages()  : array<string|int, CSSmartPage>
Returns the CSSmartPage Objects
getPdf()  : string
Creates a PDF file for a smart document and returns the file link
getPlugin()  : CSSmartTemplatePlugin
Returns the CSSmartTemplatePlugin this template is based on
getProtection()  : array<string|int, mixed>
Describes the current Document Protection Settings
getRegionFlowHtml()  : string
This method is used to get the HTML which will be placed directly before the closing body tag of the output html.
getRenderer()  : mixed
Retrieves a renderer for the given format
getRightPageFooter()  : string
getRightPageHeader()  : string
getTrimBox()  : mixed
Tells if the final document should be rendered with TrimBox
getUserPassword()  : string
getWatermark()  : string
Retrievs the actual watermark URL if set
getXml()  : mixed
Gets the optional xml container that can receive a string, DOM or SimpleXml object
getZoom()  : string
Gets the initial zoom level in which a viewer should display the document
isUnicode()  : bool
Defines if the document content will be passed in unicode
makePdf()  : string
Applies all overwrites and then renders the pdf for the current document content and stores it to a cache file
overwriteHtml()  : void
Once you have an instantiated template you can overwrite one ore more html snippets As the template is also inheriting the CSSmartDocument you can also apply all other modifications as with any other CSSmartDocument.
protect()  : mixed
Protects the Document and defines an optional user (read) and admin (use protected functions) password
removePage()  : CSSmartPage
Removes a page(-flow) Can be used for example from a CSSmartTemplate to remove unwanted pages
render()  : mixed
Renders the document for a given rendition format
setArtBox()  : void
Renders the final document with Artbox
setBleedBox()  : void
Renders the final document with BleedBox
setCreationDate()  : void
Sets the creation date for the original creation time
setCreationPreset()  : void
Sets the creation preset used for the original creation
setCreationTemplate()  : void
Sets the creation template name used for the original creation
setCreationUserID()  : void
Sets the creation user that originally created the document
setDisplayMode()  : void
Sets the way how a viewer should display the document
setEncoding()  : void
Sets the charset encoding of the Smart Document content
setFirstPageFooter()  : void
Sets the first page footer
setFirstPageHeader()  : void
Sets the first page header
setFormat()  : void
Overwrites the format of the document
setLayout()  : void
Sets the layout in which a viewer should display the document
setLeftPageFooter()  : void
Sets the left page footer
setLeftPageHeader()  : void
Sets the left page header
setMargin()  : void
Sets all 4 margins of the document
setMarginBottom()  : void
Sets the bottom margin of the document
setMarginLeft()  : void
Sets the left margin of the document
setMarginRight()  : void
Sets the right margin of the document
setMarginTop()  : void
Sets the top margin of the document
setMediaBox()  : void
Renders the final document with MediaBox
setMetaAuthor()  : void
Returns the Author Property which is for example seen in the Adobe Readers Properties Dialog
setMetaConformance()  : mixed
Sets the Conformance Property which is used to decide format of pdf generated by pdfreactor.
setMetaKeywords()  : void
Returns the Keywords Property which is for example seen in the Adobe Readers Properties Dialog
setMetaSubject()  : void
Sets the Subject Property which is for example seen in the Adobe Readers Properties Dialog
setMetaTitle()  : void
Sets the Title Property which is for example seen in the Adobe Readers Properties Dialog
setMetaVersion()  : string
Sets the Version Property which is for example seen in the Adobe Readers Properties Dialog
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
setRegionFlowHtml()  : mixed
This method is used to add HTML to an smart document outside of an page context. The added html will be placed directly before the closing body tag of the output html.
setRightPageFooter()  : void
Sets the right page footer
setRightPageHeader()  : void
Sets the right page header
setTrimBox()  : void
Renders the final document with TrimBox
setUnicode()  : void
Sets if the content of the document will be passed in unicode
setWatermark()  : void
Renders the final document with a Watermark in the background
setXml()  : mixed
Sets the optional xml container that can receive a string, DOM or SimpleXml object
setZoom()  : void
Sets the initial zoom level in which a viewer should display the document
streamHtml()  : void
Applies all overwrites and then renders the current document content as html and streams it to the requester
streamPdf()  : void
Applies all overwrites and then renders the pdf for the current document content and streams it to the requester

Methods

__construct()

The constructor is normally not directly invoked. Instead use the method @link CSSmart::createTemplate

public __construct(string $pluginPrefix, CSSmartPreset $preset) : CSSmartTemplate
Parameters
$pluginPrefix : string

the unique plugin prefix, for example foo when the plugin is fooSmartTemplate

$preset : CSSmartPreset

an array with plugin specific parameters, where the key is the name of the parameter

Tags
throws
ErrorException

if no such plugin is found

access

protected

ignored
Return values
CSSmartTemplate

the Smart Template

addCSSCode()

Adds CSS Code to the Document that is applied to all pages

public addCSSCode(string $code) : void
Parameters
$code : string

css code

Tags
access

public

Return values
void

Adds CSS Code in a css file to the document that is applied to all pages

public addCSSLink(string $link) : void
Parameters
$link : string

link to the css file that can be found by the file_get_contents method

Tags
access

public

Return values
void

addFontFile()

Adds a ttf font file to be used in the PDF

public addFontFile(string $file) : mixed
Parameters
$file : string

the path to the ttf font file

Tags
Return values
mixed

addIndex()

Displays an index collecting all defined bookmarks

public addIndex([mixed $title = 'Index' ][, int $titleSize = '18' ][, int $textSize = '12' ][, bool $addSelfToIndex = FALSE ][, bool $showPageNumbers = TRUE ], int $onPageNumber[, string $fontFamily = 'Helvetica' ]) : void
Parameters
$title : mixed = 'Index'
$titleSize : int = '18'

size in mm of font for index title

$textSize : int = '12'

size in mm of font for index text

$addSelfToIndex : bool = FALSE

adds another bookmark to the index itself

$showPageNumbers : bool = TRUE

if set to true the page numbers are shown for the bookmarks

$onPageNumber : int

on which absolute page the index should be added. If left empty the index will be added at the end

$fontFamily : string = 'Helvetica'

the name of the font to use for the index, e.g. "Verdana"

Tags
Param

string $title the title of the index

see
CSSmartPage::addBookmark()
access

public

Return values
void

addJSCode()

Adds JS Code to the Document that is applied to all pages

public addJSCode(string $code) : void
Parameters
$code : string

js code

Tags
access

public

Return values
void

Adds JS Code in a js file to the document that is applied to all pages

public addJSLink(string $link) : void
Parameters
$link : string

link to the js file that can be found by the file_get_contents method

Tags
access

public

Return values
void

addPage()

Adds another page(-flow) to the document that can be modified and filled with html content afterwards

public addPage([string $html = '' ][, string $headerHtml = '' ][, string $footerHtml = '' ][, string $key = FALSE ]) : CSSmartPage
Parameters
$html : string = ''

initial html to place on that page, you can add more html later on the page object

$headerHtml : string = ''

initial html to place on the page header, you can add more html later on the page object

$footerHtml : string = ''

initial html to place on the page footer, you can add more html later on the page object

$key : string = FALSE

an optional key that identifies the html and makes it possible to overwrite the html for others

Tags
Return values
CSSmartPage

the resulting page

calculateOrientation()

Finds out if the document width and height ratio is Landscape or Portrait

public calculateOrientation() : string
Tags
access

public

Return values
string

one of the CSSmart::ORIENTATION constants

collectHtml()

This methods accumulates all html fragments of the pages and the document css to one array

public collectHtml() : array<string|int, mixed>

This is done by maintaining the keys provided when the html was added, which allows Template developers to overwrite html fragments of a given template

See the @see CSSmartTemplate::overwrite method to understand how a template can overwrite predefined output

Tags
access

public

Return values
array<string|int, mixed>

with the html fragments

convertOTFFont()

Converts an Open Type Font to an True Type Font.

public static convertOTFFont(string $sFontFilePath, string $sFontFolder) : bool|string
Parameters
$sFontFilePath : string

The path to the OTF File

$sFontFolder : string

The fonts folder where the converted file should be placed.

Tags
Return values
bool|string

FALSE if the convert failed otherwise an string containing the path to the ttf file

convertTTCFont()

Converts a True Type Collection to single True Type Fonts.

public static convertTTCFont(string $sFontFilePath, string $sFontFolder) : array<string|int, mixed>|bool
Parameters
$sFontFilePath : string

The path to the TTC File

$sFontFolder : string

The fonts folder where the converted files should be placed.

Tags
Return values
array<string|int, mixed>|bool

FALSE if the convert failed otherwise an array containing the ttf file paths

createRenderer()

Creates a CSSmartRendererPlugin which can be used to render the pdf for this document Normally it is not required to create your own renderer. Instead a renderer is created on the fly as soon you call up the methods @link makePdf or @link streamPdf.

public createRenderer() : CSSmartRendererPlugin

However sometimes it can be useful to retrieve your own renderer and use the renderer's @link CSSmartRendererPlugin::getHtml2Pdf method to obtain the underlying html2pdf object.

Furthermore the html2pdf object has a public pdf property which gives access to the again underlying tcpdf object.

Tags
Return values
CSSmartRendererPlugin

drawPageBox()

Enlarges or shrinks the type of boxes by the values of the document in all directions

public static drawPageBox(tcpdf $tcpdf, array<string|int, mixed> $aSlug, mixed $type, mixed $format) : mixed
Parameters
$tcpdf : tcpdf

the internal tcpdf object

$aSlug : array<string|int, mixed>

values of left bottom x,left bottom y and right top x,right top y

$type : mixed
$format : mixed

The format used of the document

Tags
access

public

deprecated

since CS19.X. With the new major version of the tcpdf lib, we can only set the page format in its constructor. This means, we can only Enlarges or shrinks the type of boxes in its constructor.

see
getBoxValues()
Return values
mixed

drawPrinterMarks()

Enlarges the MediaBox by the slug of the document in all directions and draws cropmarks, registrations marks and color bars

public static drawPrinterMarks(TCPdf $tcpdf, float $slug, float $height, float $width, float $barHeight, float $barWidth, float $registrationHeight, float $outerHeight, float $outerWidth) : mixed
Parameters
$tcpdf : TCPdf

the internal tcpdf object

$slug : float

the cropbox

$height : float

height of the document

$width : float

width of the document

$barHeight : float

barheight required for Color Registration

$barWidth : float

barwidth required for Color Registration

$registrationHeight : float

registrationHeight needed for registration mark

$outerHeight : float

outerheight needed to set mediabox

$outerWidth : float

outerwidth needed to set mediabox

Tags
access

public

Return values
mixed

finalize()

This method will be called by the renderer once the internal tcpdf object has been created and the html output was placed. It is the final hook to deal with the extended api of the tcpdf object and passes this hook on to the template plugin

public finalize(TCPDF $tcpdf, Html2Pdf $html2pdf) : void
Parameters
$tcpdf : TCPDF
$html2pdf : Html2Pdf
Tags
access

public

Return values
void

getAdminPassword()

public getAdminPassword() : string
Tags
access

public

Return values
string

the admin password of the document if set

getArtBox()

Tells if the final document should be rendered with ArtBox

public getArtBox() : mixed
Tags
access

public returns array with coordinates

Return values
mixed

getBleedBox()

Tells if the final document should be rendered with BleedBox

public getBleedBox() : mixed
Tags
access

public returns array with coordinates

Return values
mixed

getBoxValues()

Gets the tcpdf coordinates for a (default, enlarged or shrunk) PDF box.

public static getBoxValues(array<string|int, mixed> $aSlug, mixed $sFormat) : array<string|int, mixed>
Parameters
$aSlug : array<string|int, mixed>

Values of left bottom x,left bottom y and right top x,right top y

$sFormat : mixed

The format used of the document

Tags
access

public

Return values
array<string|int, mixed>

The array of the new coordinates(leftBottomX, leftBottomY, RightTopX, RightTopY) of the document.

getCreationDate()

Gets the creation date for the original creation time

public getCreationDate() : mixed
Tags
access

public

Return values
mixed

getCreationTemplate()

Gets the creation template name used for the original creation

public getCreationTemplate() : string
Tags
access

public

Return values
string

the template name

getCreationUserID()

Gets the ID of the user that originally created the document

public getCreationUserID() : mixed
Tags
access

public

Return values
mixed

getCSS()

Returns the complete css code for the document

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

public

Return values
array<string|int, string>

array with css code or css links

getCSSHead()

Compiles the CSS Links & Snippets to a text that can be embedded into a HTML Head Element

public getCSSHead([string $base = 'external' ][, string $format = '' ]) : string
Parameters
$base : string = 'external'

can be external (absolute) or internal (absolute)

$format : string = ''

can be empty, html or pdf

Tags
access

public

Return values
string

the css head text

getDisplayMode()

Gets the way how a viewer should display the document, e.g. with thumbs or with tree navigation

public getDisplayMode() : string
Tags
Return values
string

one the CSSmart::DISPLAY constants

getEncoding()

Defines the encoding of the document content

public getEncoding() : string
Tags
access

public

Return values
string

the encoding of the document content, e.g. 'UTF-8'

getFirstPageFooter()

public getFirstPageFooter() : string
Tags
access

public

Return values
string

first page footer content

getFirstPageHeader()

public getFirstPageHeader() : string
Tags
access

public

Return values
string

first page header content

getFontFiles()

Retrieve the additional fonts defined for this document

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

public

Return values
array<string|int, mixed>

path to the ttf font file

getFontName()

This method converts the file base name of an ttf font to the internal name used by tcpdf. this needs to be done to use the same font names in css and tcpdf.

public static getFontName(mixed $sFileName) : mixed
Parameters
$sFileName : mixed
Tags
Return values
mixed

getFormat()

Gets the format of the document

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

public

Return values
string

getIndices()

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

public

Return values
array<string|int, mixed>

with the index information

getJS()

Returns the complete js code for the document

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

public

Return values
array<string|int, string>

array with js code or css links

getJSHead()

Compiles the JS Links & Snippets to a text that can be embedded into a HTML Head Element

public getJSHead([string $base = 'external' ][, string $format = '' ]) : string
Parameters
$base : string = 'external'

can be external (absolute) or internal (absolute)

$format : string = ''

can be empty, html or pdf

Tags
access

public

Return values
string

the js head text

getLayout()

Gets the layout in which a viewer should display the document

public getLayout() : string
Tags
Return values
string

one the CSSmart::LAYOUT constants

getLeftPageFooter()

public getLeftPageFooter() : string
Tags
access

public

Return values
string

left page footer content

getLeftPageHeader()

public getLeftPageHeader() : string
Tags
access

public

Return values
string

left page header content

getMarginBottom()

Returns the bottom margin of the document

public getMarginBottom() : string
Tags
access

public

Return values
string

the margin in mm

getMarginLeft()

Returns the left margin of the document

public getMarginLeft() : string
Tags
access

public

Return values
string

the margin in mm

getMarginRight()

Returns the right margin of the document

public getMarginRight() : string
Tags
access

public

Return values
string

the margin in mm

getMarginTop()

Returns the top margin of the document

public getMarginTop() : string
Tags
access

public

Return values
string

the margin in mm

getMediaBox()

Tells if the final document should be rendered with MediaBox

public getMediaBox() : mixed
Tags
access

public returns array with coordinates

Return values
mixed

getMetaAuthor()

Sets the Author Property which is for example seen in the Adobe Readers Properties Dialog

public getMetaAuthor() : string
Tags
access

public

Return values
string

the name of the author

getMetaConformance()

Returns the Conformance Property which is used to decide format of pdf generated by pdfreactor.

public getMetaConformance() : void
Tags
access

public

Return values
void

getMetaKeywords()

Sets the Keywords Property which is for example seen in the Adobe Readers Properties Dialog

public getMetaKeywords() : string
Tags
access

public

Return values
string

$keywords any keywords

getMetaSubject()

Returns the Subject Property which is for example seen in the Adobe Readers Properties Dialog

public getMetaSubject() : string
Tags
access

public

Return values
string

the subject

getMetaTitle()

Returns the Title Property which is for example seen in the Adobe Readers Properties Dialog

public getMetaTitle() : string
Tags
access

public

Return values
string

the title

getMetaVersion()

Returns the Version Property which is for example seen in the Adobe Readers Properties Dialog

public getMetaVersion() : void
Tags
access

public

Return values
void

getNumberOfPages()

public getNumberOfPages() : int
Tags
access

public

Return values
int

the number of all real pages of the document

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

getPages()

Returns the CSSmartPage Objects

public getPages() : array<string|int, CSSmartPage>
Tags
access

public

Return values
array<string|int, CSSmartPage>

with CSSmartPage Objects for this document

getPdf()

Creates a PDF file for a smart document and returns the file link

public getPdf([int $dpi = 72 ][, string $colorspace = 'rgb' ]) : string
Parameters
$dpi : int = 72

the dpi of the images

$colorspace : string = 'rgb'

the colorspace of the images

Tags
access

public

Return values
string

the relative file link to the

getProtection()

Describes the current Document Protection Settings

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

public

Return values
array<string|int, mixed>

with allows interactions, if empty all interactions are allowed

getRegionFlowHtml()

This method is used to get the HTML which will be placed directly before the closing body tag of the output html.

public getRegionFlowHtml() : string
Tags
Return values
string

getRenderer()

Retrieves a renderer for the given format

public getRenderer(mixed $sFormat) : mixed
Parameters
$sFormat : mixed
Tags
throws
Exception
Return values
mixed

getRightPageFooter()

public getRightPageFooter() : string
Tags
access

public

Return values
string

right page footer content

getRightPageHeader()

public getRightPageHeader() : string
Tags
access

public

Return values
string

right page header content

getTrimBox()

Tells if the final document should be rendered with TrimBox

public getTrimBox() : mixed
Tags
access

public returns array with coordinates

Return values
mixed

getUserPassword()

public getUserPassword() : string
Tags
access

public

Return values
string

the user password of the document if set

getWatermark()

Retrievs the actual watermark URL if set

public getWatermark() : string
Tags
access

public

Return values
string

the Watermark URL

getXml()

Gets the optional xml container that can receive a string, DOM or SimpleXml object

public getXml() : mixed
Tags
Return values
mixed

XML either a string, DOM or SimpleXml object

getZoom()

Gets the initial zoom level in which a viewer should display the document

public getZoom() : string
Tags
Return values
string

one the CSSmart::ZOOM constants

isUnicode()

Defines if the document content will be passed in unicode

public isUnicode() : bool
Tags
access

public

Return values
bool

true if the document content will be passed in unicode

makePdf()

Applies all overwrites and then renders the pdf for the current document content and stores it to a cache file

public makePdf([string $path = '' ]) : string
Parameters
$path : string = ''

the absolute or relative (to the project) pdf directory and file name in one string

Tags
access

public

Return values
string

$path the final directory and file in one string where the pdf was stored to

overwriteHtml()

Once you have an instantiated template you can overwrite one ore more html snippets As the template is also inheriting the CSSmartDocument you can also apply all other modifications as with any other CSSmartDocument.

public overwriteHtml(string $pageKey, string $htmlKey, string $html) : void
Parameters
$pageKey : string

the key of the page you want to overwrite

$htmlKey : string

the key of the html snippet within this page you want to overwrite

$html : string

the new html snippet that should overwrite the previous version

Tags
access

public

Return values
void

protect()

Protects the Document and defines an optional user (read) and admin (use protected functions) password

public protect([string $userPassword = '' ][, string $adminPassword = '' ][, bool $allowPrinting = TRUE ][, bool $allowCopying = TRUE ][, bool $allowModification = TRUE ][, bool $allowAnnotation = TRUE ]) : mixed
Parameters
$userPassword : string = ''

the user password of the document, if set the document content can only be viewed after providing this password

$adminPassword : string = ''

the admin password of the document, if set protected functions can only be accessed after providing this password

$allowPrinting : bool = TRUE

if the user should be able to print the document

$allowCopying : bool = TRUE

if the user should be able to copy content to the clipboard

$allowModification : bool = TRUE

if the user should be able to modify the content

$allowAnnotation : bool = TRUE

if eht user should be allowed to annotate the document

Tags
Return values
mixed

removePage()

Removes a page(-flow) Can be used for example from a CSSmartTemplate to remove unwanted pages

public removePage(string $key) : CSSmartPage
Parameters
$key : string

the key that was used when adding the page

Tags
access

public

Return values
CSSmartPage

the removed page

render()

Renders the document for a given rendition format

public render([string $sFormat = 'pdf' ][, bool $bStream = true ][, CSSmartPreset $oPreset = null ]) : mixed
Parameters
$sFormat : string = 'pdf'

the format to render, e.g. pdf, smart or html

$bStream : bool = true

if true the resulting file will be opened directly in the browser

$oPreset : CSSmartPreset = null

the preset that will be used to render

Tags
access

public

throws
Exception
Return values
mixed

setArtBox()

Renders the final document with Artbox

public setArtBox(float $artBoxTopOrAll[, float $artBoxRight = NULL ][, float $artBoxBottom = NULL ][, float $artBoxLeft = NULL ]) : void
Parameters
$artBoxTopOrAll : float

: Sets the pageBox from the top or left,right,bottom,top

$artBoxRight : float = NULL

: Sets the pageBox from the right

$artBoxBottom : float = NULL

: Sets the pageBox from the bottom

$artBoxLeft : float = NULL

: Sets the pageBox from the left

Tags
access

public

Return values
void

setBleedBox()

Renders the final document with BleedBox

public setBleedBox(float $bleedBoxTopOrAll[, float $bleedBoxRight = NULL ][, float $bleedBoxBottom = NULL ][, float $bleedBoxLeft = NULL ]) : void
Parameters
$bleedBoxTopOrAll : float

: Sets the pageBox from the top or left,right,bottom,top

$bleedBoxRight : float = NULL

: Sets the pageBox from the right

$bleedBoxBottom : float = NULL

: Sets the pageBox from the bottom

$bleedBoxLeft : float = NULL

: Sets the pageBox from the left

Tags
access

public

Return values
void

setCreationDate()

Sets the creation date for the original creation time

public setCreationDate(string $date) : void
Parameters
$date : string

the date string

Tags
access

public

Return values
void

setCreationPreset()

Sets the creation preset used for the original creation

public setCreationPreset(string $preset) : void
Parameters
$preset : string

the preset

Tags
access

public

Return values
void

setCreationTemplate()

Sets the creation template name used for the original creation

public setCreationTemplate(string $templateName) : void
Parameters
$templateName : string

the name of the template

Tags
access

public

Return values
void

setCreationUserID()

Sets the creation user that originally created the document

public setCreationUserID(int $UserID) : void
Parameters
$UserID : int

the ID of the creation user

Tags
access

public

Return values
void

setDisplayMode()

Sets the way how a viewer should display the document

public setDisplayMode([string $displayMode = CSSmart::DISPLAY_MODE_THUMBS ]) : void
Parameters
$displayMode : string = CSSmart::DISPLAY_MODE_THUMBS

one the CSSmart::DISPLAY constants

Tags
Return values
void

setEncoding()

Sets the charset encoding of the Smart Document content

public setEncoding(string $encoding) : void
Parameters
$encoding : string

the encoding of the document content, e.g. "UTF-8"

Tags
access

public

Return values
void

setFirstPageFooter()

Sets the first page footer

public setFirstPageFooter(string $sContent) : void
Parameters
$sContent : string

footer content

Tags
Return values
void

setFirstPageHeader()

Sets the first page header

public setFirstPageHeader(string $sContent) : void
Parameters
$sContent : string

header content

Tags
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

setLayout()

Sets the layout in which a viewer should display the document

public setLayout([string $layout = CSSmart::LAYOUT_TWO_COLUMN_RIGHT ]) : void
Parameters
$layout : string = CSSmart::LAYOUT_TWO_COLUMN_RIGHT

one the CSSmart::LAYOUT constants

Tags
Return values
void

setLeftPageFooter()

Sets the left page footer

public setLeftPageFooter(string $sContent) : void
Parameters
$sContent : string

footer content

Tags
Return values
void

setLeftPageHeader()

Sets the left page header

public setLeftPageHeader(string $sContent) : void
Parameters
$sContent : string

header content

Tags
Return values
void

setMargin()

Sets all 4 margins of the document

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

the top margin in mm, if only this is provided all margins are set to the top value

$right : float = NULL

the right margin in mm

$bottom : float = NULL

the bottom margin in mm

$left : float = NULL

the left margin in mm

Tags
access

public

Return values
void

setMarginBottom()

Sets the bottom margin of the document

public setMarginBottom(float $margin) : void
Parameters
$margin : float

the margin in mm

Tags
access

public

Return values
void

setMarginLeft()

Sets the left margin of the document

public setMarginLeft(float $margin) : void
Parameters
$margin : float

the margin in mm

Tags
access

public

Return values
void

setMarginRight()

Sets the right margin of the document

public setMarginRight(float $margin) : void
Parameters
$margin : float

the margin in mm

Tags
access

public

Return values
void

setMarginTop()

Sets the top margin of the document

public setMarginTop(float $margin) : void
Parameters
$margin : float

the margin in mm

Tags
access

public

Return values
void

setMediaBox()

Renders the final document with MediaBox

public setMediaBox(float $mediaBoxTopOrAll[, float $mediaBoxRight = NULL ][, float $mediaBoxBottom = NULL ][, float $mediaBoxLeft = NULL ]) : void
Parameters
$mediaBoxTopOrAll : float

: Sets the pageBox from the top or left,right,bottom,top

$mediaBoxRight : float = NULL

: Sets the pageBox from the right

$mediaBoxBottom : float = NULL

: Sets the pageBox from the bottom

$mediaBoxLeft : float = NULL

: Sets the pageBox from the left

Tags
access

public

Return values
void

setMetaAuthor()

Returns the Author Property which is for example seen in the Adobe Readers Properties Dialog

public setMetaAuthor(string $author) : void
Parameters
$author : string

the name of the Author

Tags
access

public

Return values
void

setMetaConformance()

Sets the Conformance Property which is used to decide format of pdf generated by pdfreactor.

public setMetaConformance(mixed $conformance) : mixed
Parameters
$conformance : mixed
Tags
access

public

Return values
mixed

setMetaKeywords()

Returns the Keywords Property which is for example seen in the Adobe Readers Properties Dialog

public setMetaKeywords(string $keywords) : void
Parameters
$keywords : string

the keywords

Tags
access

public

Return values
void

setMetaSubject()

Sets the Subject Property which is for example seen in the Adobe Readers Properties Dialog

public setMetaSubject(string $subject) : void
Parameters
$subject : string

the subject

Tags
access

public

Return values
void

setMetaTitle()

Sets the Title Property which is for example seen in the Adobe Readers Properties Dialog

public setMetaTitle(string $title) : void
Parameters
$title : string

the title

Tags
access

public

Return values
void

setMetaVersion()

Sets the Version Property which is for example seen in the Adobe Readers Properties Dialog

public setMetaVersion(mixed $version) : string
Parameters
$version : mixed
Tags
access

public

Return values
string

version the PDF version string

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

setRegionFlowHtml()

This method is used to add HTML to an smart document outside of an page context. The added html will be placed directly before the closing body tag of the output html.

public setRegionFlowHtml([string $sHtml = '' ]) : mixed

This can be used to create an region flow for pdfreactor.

Parameters
$sHtml : string = ''

The html which should be added to the document

Tags
Return values
mixed

setRightPageFooter()

Sets the right page footer

public setRightPageFooter(string $sContent) : void
Parameters
$sContent : string

footer content

Tags
Return values
void

setRightPageHeader()

Sets the right page header

public setRightPageHeader(string $sContent) : void
Parameters
$sContent : string

header content

Tags
Return values
void

setTrimBox()

Renders the final document with TrimBox

public setTrimBox(float $trimBoxTopOrAll[, float $trimBoxRight = NULL ][, float $trimBoxBottom = NULL ][, float $trimBoxLeft = NULL ]) : void
Parameters
$trimBoxTopOrAll : float

: Sets the pageBox from the top or left,right,bottom,top

$trimBoxRight : float = NULL

: Sets the pageBox from the right

$trimBoxBottom : float = NULL

: Sets the pageBox from the bottom

$trimBoxLeft : float = NULL

: Sets the pageBox from the left

Tags
access

public

Return values
void

setUnicode()

Sets if the content of the document will be passed in unicode

public setUnicode(bool $boolean) : void
Parameters
$boolean : bool

true if the Smart Document content will be passed in unicode

Tags
access

public

Return values
void

setWatermark()

Renders the final document with a Watermark in the background

public setWatermark(string $watermark) : void
Parameters
$watermark : string

url of the Watermark

Tags
access

public

Return values
void

setXml()

Sets the optional xml container that can receive a string, DOM or SimpleXml object

public setXml(mixed $xml) : mixed
Parameters
$xml : mixed

either a string, DOM or SimpleXml object

Tags
Return values
mixed

setZoom()

Sets the initial zoom level in which a viewer should display the document

public setZoom([string $zoom = CSSmart::ZOOM_DEFAULT ]) : void
Parameters
$zoom : string = CSSmart::ZOOM_DEFAULT

one the CSSmart::ZOOM constants

Tags
Return values
void

streamHtml()

Applies all overwrites and then renders the current document content as html and streams it to the requester

public streamHtml() : void
Tags
access

public

Return values
void

streamPdf()

Applies all overwrites and then renders the pdf for the current document content and streams it to the requester

public streamPdf([string $filename = '' ][, bool $inline = TRUE ]) : void
Parameters
$filename : string = ''

an optional filename the PDF should have when downloaded

$inline : bool = TRUE

if true the browser will be advised to open the pdf within the browser (if supported)

Tags
access

public

Return values
void

        

Search results