eZ Publish Community Project (Legacy Stack) 2013.4
Class

Cezpdf

class Cezpdf extends Cpdf

Properties

$numObj the current number of pdf objects in the document
$objects this array contains all of the pdf objects, ready for final assembly
$catalogId the objectId (number within the objects array) of the document catalog
$fonts array carrying information about the fonts that the system currently knows about used to ensure that a font is not loaded twice, among other things
$currentFont a record of the current font
$currentBaseFont the current base font
$currentFontNum the number of the current font within the font array
$currentNode
$currentPage object number of the current page
$currentContents object number of the currently active contents block
$numFonts number of fonts within the system
$currentColour current colour for fill operations, defaults to inactive value, all three components should be between 0 and 1 inclusive when active
$currentStrokeColour current colour for stroke operations (lines etc.)
$currentLineStyle current style that lines are drawn in
$stateStack an array which is used to save the state of the document, mainly the colours and styles it is used to temporarily change to another state, the change back to what it was before
$nStateStack number of elements within the state stack
$numPages number of page objects within the document
$stack object Id storage stack
$nStack number of elements within the object Id storage stack
$looseObjects an array which contains information about the objects which are not firmly attached to pages these have been added with the addObject function
$addLooseObjects array contains infomation about how the loose objects are to be added to the document
$infoObject the objectId of the information object for the document this contains authorship, title etc.
$numImages number of images being tracked within the document
$options an array containing options about the document it defaults to turning on the compression of the objects
$firstPageId the objectId of the first page of the document
$wordSpaceAdjust used to track the last used value of the inter-word spacing, this is so that it is known when the spacing is changed.
$procsetObjectId the object Id of the procset object
$fontFamilies store the information about the relationship between font families this used so that the code knows which font is the bold version of another font, etc.
$currentTextState track if the current font is bolded or italicised
$messages messages are stored here during processing, these can be selected afterwards to give some useful debug information
$arc4 the ancryption array for the document encryption is stored here
$arc4_objnum the object Id of the encryption information
$fileIdentifier the file identifier, used to uniquely identify a pdf document
$encrypted a flag to say if a document is to be encrypted or not
$encryptionKey the ancryption key for the encryption of all the document content (structure is not encrypted)
$callback array which forms a stack to keep track of nested callback functions
$nCallback the number of callback functions in the callback array
$destinations store label->id pairs for named destinations, these will be used to replace internal links done this way so that destinations can be defined after the location that links to them
$checkpoint store the stack for the transaction commands, each item in here is a record of the values of all the variables within the class, so that the user can rollback at will (from each 'start' command) note that this includes the objects array, so these can be large.
$textStateStack
$ez
$y
$ezPages
$ezPageCount
$LeftMarginArray
$RightMarginArray

Methods

Cpdf($pageSize = array(0, 0, 612, 792))

class constructor this will start a new document

from Cpdf
o_destination($id, $action, $options = '')

destination object, used to specify the location for the user to jump to, presently on opening

from Cpdf
o_viewerPreferences($id, $action, $options = '')

set the viewer preferences

from Cpdf
o_catalog($id, $action, $options = '')

define the document catalog, the overall controller for the document

from Cpdf
o_pages($id, $action, $options = '')

object which is a parent to the pages in the document

from Cpdf
o_outlines($id, $action, $options = '')

define the outlines in the doc, empty for now

from Cpdf
o_function($id, $action, $options = '')

Add object to hold Function properties Only partial support for type 0, 3 and 4

from Cpdf
o_pattern($id, $action, $options = '')

Add object to hold pattern properties

from Cpdf
o_shading($id, $action, $options = '')

Add object to hold shading properties

from Cpdf
o_font($id, $action, $options = '')

an object to hold the font description

from Cpdf
o_fontDescriptor($id, $action, $options = '')

a font descriptor, needed for including additional fonts

from Cpdf
o_fontEncoding($id, $action, $options = '')

the font encoding

from Cpdf
o_procset($id, $action, $options = '')

the document procset, solves some problems with printing to old PS printers

from Cpdf
o_info($id, $action, $options = '')

define the document information

from Cpdf
o_action($id, $action, $options = '')

an action object, used to link to URLS initially

from Cpdf
o_annotation($id, $action, $options = '')

an annotation object, this will add an annotation to the current page.

from Cpdf
o_page($id, $action, $options = '')

a page object, it also creates a contents object to hold its contents

from Cpdf
o_contents($id, $action, $options = '')

the contents objects hold all of the content which appears on pages

from Cpdf
o_image($id, $action, $options = '')

an image object, will be an XObject in the document, includes description and data

from Cpdf
o_encryption($id, $action, $options = '')

encryption object.

from Cpdf
md5_16($string)

calculate the 16 byte version of the 128 bit md5 digest of the string

from Cpdf
encryptInit($id)

initialize the encryption for processing a particular object

from Cpdf
ARC4_init($key = '')

initialize the ARC4 encryption

from Cpdf
ARC4($text)

ARC4 encrypt a text string

from Cpdf
addLink($url, $x0, $y0, $x1, $y1)

add a link in the document to an external URL

from Cpdf
addInternalLink($label, $x0, $y0, $x1, $y1)

add a link in the document to an internal destination (ie.

from Cpdf
setEncryption($userPass = '', $ownerPass = '', $pc = array())

set the encryption of the document can be used to turn it on and/or set the passwords which it will have.

from Cpdf
checkAllHere()

should be used for internal checks, not implemented as yet

from Cpdf
output($debug)

return the pdf stream as a string returned from the function

from Cpdf
newDocument($pageSize = array(0, 0, 612, 792))

intialize a new document if this is called on an existing document results may be unpredictable, but the existing document would be lost at minimum this function is called automatically by the constructor function

from Cpdf
openFont($font)

open the font file and return a php structure containing it.

from Cpdf
selectFont($fontName, $encoding = '', $set = 1)

if the font is not loaded then load it and make the required object else just make it the current font the encoding array can contain 'encoding'=> 'none','WinAnsiEncoding','MacRomanEncoding' or 'MacExpertEncoding' note that encoding='none' will need to be used for symbolic fonts and 'differences' => an array of mappings between numbers 0->255 and character names.

from Cpdf
currentFont()

Get current font

from Cpdf
setCurrentFont()

sets up the current font, based on the font families, and the current text state note that this system is quite flexible, a font can be completely different to a font, and even will have to be defined within the family to have meaning This function is to be called whenever the currentTextState is changed, it will update the currentFont setting to whatever the appropriatte family one is.

from Cpdf
getFirstPageId()

function for the user to find out what the ID is of the first page that was created during startup - useful if they wish to add something to it later.

from Cpdf
addContent($content)

add content to the currently active object

from Cpdf
setColorRGB($r, $g, $b, $force)

sets the colour for fill operations

from Cpdf
setColor($cmykArray, $force)

from Cpdf
setStrokeColorRGB($r, $g, $b, $force)

sets the colour for stroke operations

from Cpdf
setStrokeColor($cmykArray, $force)

from Cpdf
line($x1, $y1, $x2, $y2)

draw a line from one set of coordinates to another

from Cpdf
curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3)

draw a bezier curve based on 4 control points

from Cpdf
partEllipse($x0, $y0, $astart, $afinish, $r1, $r2, $angle, $nSeg = 8)

draw a part of an ellipse

from Cpdf
filledEllipse($x0, $y0, $r1, $r2, $angle, $nSeg = 8, $astart, $afinish = 360)

draw a filled ellipse

from Cpdf
ellipse($x0, $y0, $r1, $r2, $angle, $nSeg = 8, $astart, $afinish = 360, $close = 1, $fill)

draw an ellipse note that the part and filled ellipse are just special cases of this function

from Cpdf
setLineStyle($width = 1, $cap = '', $join = '', $dash = '', $phase)

this sets the line drawing style.

from Cpdf
polygon($p, $np, $f)

draw a polygon, the syntax for this is similar to the GD polygon command

from Cpdf
shadedRectangle($x1, $y1, $width, $height, $options)

Create shaded rectangle area

from Cpdf
filledRectangle($x1, $y1, $width, $height)

a filled rectangle, note that it is the width and height of the rectangle which are the secondary paramaters, not the coordinates of the upper-right corner

from Cpdf
rectangle($x1, $y1, $width, $height)

draw a rectangle, note that it is the width and height of the rectangle which are the secondary paramaters, not the coordinates of the upper-right corner

from Cpdf
newPage($insert, $id, $pos = 'after')

add a new page to the document this also makes the new page the current active object

from Cpdf
stream($options = '')

output the pdf code, streaming it to the browser the relevant headers are set so that hopefully the browser will recognise it

from Cpdf
getFontHeight($size = false)

return the height in units of the current font in the given size

from Cpdf
getFontDecender($size = false)

return the font decender, this will normally return a negative number if you add this number to the baseline, you get the level of the bottom of the font it is in the pdf user units

from Cpdf
filterText($text)

filter the text, this is applied to all text just before being inserted into the pdf document it escapes the various things that need to be escaped, and so on

from Cpdf
PRVTgetTextPosition($x, $y, $angle, $size, $wa, $text)

given a start position and information about how text is to be laid out, calculate where on the page the text will end

from Cpdf
PRVTcheckTextDirective($text, $i, $f, $final)

wrapper function for PRVTcheckTextDirective1

from Cpdf
PRVTcheckTextDirective1($text, $i, $f, $final, $x, $y, $size, $angle, $wordSpaceAdjust)

checks if the text stream contains a control directive if so then makes some changes and returns the number of characters involved in the directive this has been re-worked to include everything neccesary to fins the current writing point, so that the location can be sent to the callback function if required if the directive does not require a font change, then $f should be set to 0

from Cpdf
addText($x, $y, $size, $text, $angle, $wordSpaceAdjust)

add text to the document, at a specified location, size and angle on the page

from Cpdf
getTextWidth($size, $text)

calculate how wide a given text string will be on a page, at a given size.

from Cpdf
PRVTadjustWrapText($text, $actual, $width, $x, $adjust, $justification)

do a part of the calculation for sorting out the justification of the text

from Cpdf
addTextWrap($x, $y, $width, $size, $text, $justification = 'left', $angle, $test)

add text to the page, but ensure that it fits within a certain width if it does not fit then put in as much as possible, splitting at word boundaries and return the remainder.

from Cpdf
saveState($pageEnd)

this will be called at a new page to return the state to what it was on the end of the previous page, before the stack was closed down This is to get around not being able to have open 'q' across pages

from Cpdf
restoreState($pageEnd)

restore a previously saved state

from Cpdf
openObject()

make a loose object, the output will go into this object, until it is closed, then will revert to the current one.

from Cpdf
reopenObject($id)

open an existing object for editing

from Cpdf
closeObject()

close an object

from Cpdf
stopObject($id)

stop an object from appearing on pages from this point on

from Cpdf
addObject($id, $options = 'add')

after an object has been created, it wil only show if it has been added, using this function.

from Cpdf
addInfo($label, $value)

add content to the documents info object

from Cpdf
setPreferences($label, $value)

set the viewer preferences of the document, it is up to the browser to obey these.

from Cpdf
PRVT_getBytes($data, $pos, $num)

extract an integer from a position in a byte stream

from Cpdf
addPngFromFile($file, $x, $y, $w, $h)

add a PNG image into the document, from a file this should work with remote files

from Cpdf
addJpegFromFile($img, $x, $y, $w, $h)

add a JPEG image into the document, from a file

from Cpdf
addImage($img, $x, $y, $w, $h, $quality = 75)

add an image into the document, from a GD object this function is not all that reliable, and I would probably encourage people to use the file based functions

from Cpdf
addJpegImage_common($data, $x, $y, $w, $h, $imageWidth, $imageHeight, $channels = 3)

common code used by the two JPEG adding functions

from Cpdf
openHere($style, $a, $b, $c)

specify where the document should open when it first starts

from Cpdf
addDestination($label, $style, $a, $b, $c)

create a labelled destination within the document

from Cpdf
setFontFamily($family, $options = '')

define font families, this is used to initialize the font families for the default fonts and for the user to add new ones for their fonts.

from Cpdf
addMessage($message)

used to add messages for use in debugging

from Cpdf
transaction($action)

a few functions which should allow the document to be treated transactionally.

from Cpdf
compareCMYK($cmykArray1, $cmykArray2)

from Cpdf
pushTextState($newState)

from Cpdf
popTextState()

from Cpdf
Cezpdf($paper = 'a4', $orientation = 'portrait')

ezSetCmMargins($top, $bottom, $left, $right)

setFontSize($size)

setJustification($align)

justification()

fontSize()

ezColumnsStart($options = array())

ezColumnsStop()

ezInsertMode($status = 1, $pageNum = 1, $pos = 'before')

ezNewPage()

ezSetMargins($top, $bottom, $left, $right)

ezGetCurrentPageNumber()

ezStartPageNumbers($x, $y, $size, $pos = 'left', $pattern = '{PAGENUM} of {TOTALPAGENUM}', $num = '')

ezWhatPageNumber($pageNum, $i)

ezStopPageNumbers($stopTotal, $next, $i)

ezPRVTpageNumberSearch($lbl, $tmp)

ezPRVTaddPageNumbers()

ezPRVTcleanUp()

ezStream($options = '')

ezOutput($options)

ezSetY($y)

ezSetDy($dy, $mod = '')

ezPrvtTableDrawLines($pos, $gap, $x0, $x1, $y0, $y1, $y2, $col, $inner, $outer, $opt = 1)

ezPrvtTableColumnHeadings($cols, $pos, $maxWidth, $height, $decender, $gap, $size, $y, $optionsAll = array())

eZGetMaxWordWidth($size, $text)

ezPrvtGetTextWidth($size, $text)

ezShadedRectangle($x1, $y1, $width, $height, $col1, $col2, $direction = 'vertical')

Draw a shaded rectangle

ezProcessText($text)

ezText($text, $size, $options = array(), $test)

ezImage($image, $pad = 5, $width, $resize = 'full', $just = 'center', $border = '')

loadTemplate($templateFile)

execTemplate($id, $data = array(), $options = array())

ilink($info)

alink($info, $internal)

uline($info)

strike($info)

lineHeight($options = array())

Get current line height

rightMargin($yOffset = false)

leftMargin($yOffset = false)

setLimitedLeftMargin($startY, $stopY, $leftMargin)

setLimitedRightMargin($startY, $stopY, $rightMargin)

Details

in Cpdf at line 231
public Cpdf($pageSize = array(0, 0, 612, 792))

class constructor this will start a new document

Parameters

$pageSize

in Cpdf at line 266
public o_destination($id, $action, $options = '')

destination object, used to specify the location for the user to jump to, presently on opening

Parameters

$id
$action
$options

in Cpdf at line 306
public o_viewerPreferences($id, $action, $options = '')

set the viewer preferences

Parameters

$id
$action
$options

in Cpdf at line 348
public o_catalog($id, $action, $options = '')

define the document catalog, the overall controller for the document

Parameters

$id
$action
$options

in Cpdf at line 404
public o_pages($id, $action, $options = '')

object which is a parent to the pages in the document

Parameters

$id
$action
$options

in Cpdf at line 538
public o_outlines($id, $action, $options = '')

define the outlines in the doc, empty for now

Parameters

$id
$action
$options

in Cpdf at line 580
public o_function($id, $action, $options = '')

Add object to hold Function properties Only partial support for type 0, 3 and 4

\param object id. \param action \param options

Parameters

$id
$action
$options

in Cpdf at line 662
public o_pattern($id, $action, $options = '')

Add object to hold pattern properties

\param object id. \param action \param options

\return action 'new' - dictionary name
       'out' - pdf output

Parameters

$id
$action
$options

in Cpdf at line 743
public o_shading($id, $action, $options = '')

Add object to hold shading properties

\param object id. \param action \param options

\return action 'new' - dictionary name
       'out' - pdf output

Parameters

$id
$action
$options

in Cpdf at line 846
public o_font($id, $action, $options = '')

an object to hold the font description

Parameters

$id
$action
$options

in Cpdf at line 952
public o_fontDescriptor($id, $action, $options = '')

a font descriptor, needed for including additional fonts

Parameters

$id
$action
$options

in Cpdf at line 1009
public o_fontEncoding($id, $action, $options = '')

the font encoding

Parameters

$id
$action
$options

in Cpdf at line 1056
public o_procset($id, $action, $options = '')

the document procset, solves some problems with printing to old PS printers

Parameters

$id
$action
$options

in Cpdf at line 1097
public o_info($id, $action, $options = '')

define the document information

Parameters

$id
$action
$options

in Cpdf at line 1151
public o_action($id, $action, $options = '')

an action object, used to link to URLS initially

Parameters

$id
$action
$options

in Cpdf at line 1211
public o_annotation($id, $action, $options = '')

an annotation object, this will add an annotation to the current page.

initially will support just link annotations

Parameters

$id
$action
$options

in Cpdf at line 1270
public o_page($id, $action, $options = '')

a page object, it also creates a contents object to hold its contents

Parameters

$id
$action
$options

in Cpdf at line 1339
public o_contents($id, $action, $options = '')

the contents objects hold all of the content which appears on pages

Parameters

$id
$action
$options

in Cpdf at line 1389
public o_image($id, $action, $options = '')

an image object, will be an XObject in the document, includes description and data

Parameters

$id
$action
$options

in Cpdf at line 1464
public o_encryption($id, $action, $options = '')

encryption object.

Parameters

$id
$action
$options

in Cpdf at line 1535
public md5_16($string)

calculate the 16 byte version of the 128 bit md5 digest of the string

Parameters

$string

in Cpdf at line 1547
public encryptInit($id)

initialize the encryption for processing a particular object

Parameters

$id

in Cpdf at line 1561
public ARC4_init($key = '')

initialize the ARC4 encryption

Parameters

$key

in Cpdf at line 1587
public ARC4($text)

ARC4 encrypt a text string

Parameters

$text

add a link in the document to an external URL

Parameters

$url
$x0
$y0
$x1
$y1

add a link in the document to an internal destination (ie.

within the document)

Parameters

$label
$x0
$y0
$x1
$y1

in Cpdf at line 1633
public setEncryption($userPass = '', $ownerPass = '', $pc = array())

set the encryption of the document can be used to turn it on and/or set the passwords which it will have.

also the functions that the user will have are set here, such as print, modify, add

Parameters

$userPass
$ownerPass
$pc

in Cpdf at line 1663
public checkAllHere()

should be used for internal checks, not implemented as yet

in Cpdf at line 1669
public output($debug)

return the pdf stream as a string returned from the function

Parameters

$debug

in Cpdf at line 1718
public newDocument($pageSize = array(0, 0, 612, 792))

intialize a new document if this is called on an existing document results may be unpredictable, but the existing document would be lost at minimum this function is called automatically by the constructor function

Parameters

$pageSize

in Cpdf at line 1757
public openFont($font)

open the font file and return a php structure containing it.

first check if this one has been done before and saved in a form more suited to php note that if a php serialized version does not exist it will try and make one, but will require write access to the directory to do it... it is MUCH faster to have these serialized files.

Parameters

$font

in Cpdf at line 1892
public selectFont($fontName, $encoding = '', $set = 1)

if the font is not loaded then load it and make the required object else just make it the current font the encoding array can contain 'encoding'=> 'none','WinAnsiEncoding','MacRomanEncoding' or 'MacExpertEncoding' note that encoding='none' will need to be used for symbolic fonts and 'differences' => an array of mappings between numbers 0->255 and character names.

Parameters

$fontName
$encoding
$set

in Cpdf at line 2134
public currentFont()

Get current font

\return current font name

in Cpdf at line 2151
public setCurrentFont()

sets up the current font, based on the font families, and the current text state note that this system is quite flexible, a font can be completely different to a font, and even will have to be defined within the family to have meaning This function is to be called whenever the currentTextState is changed, it will update the currentFont setting to whatever the appropriatte family one is.

If the user calls selectFont themselves then that will reset the currentBaseFont, and the currentFont This function will change the currentFont to whatever it should be, but will not change the currentBaseFont.

in Cpdf at line 2185
public getFirstPageId()

function for the user to find out what the ID is of the first page that was created during startup - useful if they wish to add something to it later.

in Cpdf at line 2195
public addContent($content)

add content to the currently active object

Parameters

$content

in Cpdf at line 2203
public setColorRGB($r, $g, $b, $force)

sets the colour for fill operations

Parameters

$r
$g
$b
$force

in Cpdf at line 2213
public setColor($cmykArray, $force)

Parameters

$cmykArray
$force

in Cpdf at line 2227
public setStrokeColorRGB($r, $g, $b, $force)

sets the colour for stroke operations

Parameters

$r
$g
$b
$force

in Cpdf at line 2238
public setStrokeColor($cmykArray, $force)

Parameters

$cmykArray
$force

in Cpdf at line 2252
public line($x1, $y1, $x2, $y2)

draw a line from one set of coordinates to another

Parameters

$x1
$y1
$x2
$y2

in Cpdf at line 2260
public curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3)

draw a bezier curve based on 4 control points

Parameters

$x0
$y0
$x1
$y1
$x2
$y2
$x3
$y3

in Cpdf at line 2271
public partEllipse($x0, $y0, $astart, $afinish, $r1, $r2, $angle, $nSeg = 8)

draw a part of an ellipse

Parameters

$x0
$y0
$astart
$afinish
$r1
$r2
$angle
$nSeg

in Cpdf at line 2279
public filledEllipse($x0, $y0, $r1, $r2, $angle, $nSeg = 8, $astart, $afinish = 360)

draw a filled ellipse

Parameters

$x0
$y0
$r1
$r2
$angle
$nSeg
$astart
$afinish

in Cpdf at line 2294
public ellipse($x0, $y0, $r1, $r2, $angle, $nSeg = 8, $astart, $afinish = 360, $close = 1, $fill)

draw an ellipse note that the part and filled ellipse are just special cases of this function

draws an ellipse in the current line style centered at $x0,$y0, radii $r1,$r2 if $r2 is not set, then a circle is drawn nSeg is not allowed to be less than 2, as this will simply draw a line (and will even draw a pretty crappy shape at 2, as we are approximating with bezier curves.

Parameters

$x0
$y0
$r1
$r2
$angle
$nSeg
$astart
$afinish
$close
$fill

in Cpdf at line 2383
public setLineStyle($width = 1, $cap = '', $join = '', $dash = '', $phase)

this sets the line drawing style.

width, is the thickness of the line in user units cap is the type of cap to put on the line, values can be 'butt','round','square' where the diffference between 'square' and 'butt' is that 'square' projects a flat end past the end of the line. join can be 'miter', 'round', 'bevel' dash is an array which sets the dash pattern, is a series of length values, which are the lengths of the on and off dashes. (2) represents 2 on, 2 off, 2 on , 2 off ... (2,1) is 2 on, 1 off, 2 on, 1 off.. etc phase is a modifier on the dash pattern which is used to shift the point at which the pattern starts.

Parameters

$width
$cap
$join
$dash
$phase

in Cpdf at line 2418
public polygon($p, $np, $f)

draw a polygon, the syntax for this is similar to the GD polygon command

Parameters

$p
$np
$f

in Cpdf at line 2448
public shadedRectangle($x1, $y1, $width, $height, $options)

Create shaded rectangle area

\param x1 \param x2 \param width \param height \param options array ( 'orientation' => <vertical|horizontal ( optianal )>, 'color0' => , 'color1' => )

Parameters

$x1
$y1
$width
$height
$options

in Cpdf at line 2468
public filledRectangle($x1, $y1, $width, $height)

a filled rectangle, note that it is the width and height of the rectangle which are the secondary paramaters, not the coordinates of the upper-right corner

Parameters

$x1
$y1
$width
$height

in Cpdf at line 2477
public rectangle($x1, $y1, $width, $height)

draw a rectangle, note that it is the width and height of the rectangle which are the secondary paramaters, not the coordinates of the upper-right corner

Parameters

$x1
$y1
$width
$height

in Cpdf at line 2486
public newPage($insert, $id, $pos = 'after')

add a new page to the document this also makes the new page the current active object

Parameters

$insert
$id
$pos

in Cpdf at line 2544
public stream($options = '')

output the pdf code, streaming it to the browser the relevant headers are set so that hopefully the browser will recognise it

Parameters

$options

in Cpdf at line 2591
public getFontHeight($size = false)

return the height in units of the current font in the given size

Parameters

$size

in Cpdf at line 2611
public getFontDecender($size = false)

return the font decender, this will normally return a negative number if you add this number to the baseline, you get the level of the bottom of the font it is in the pdf user units

Parameters

$size

in Cpdf at line 2632
public filterText($text)

filter the text, this is applied to all text just before being inserted into the pdf document it escapes the various things that need to be escaped, and so on

Parameters

$text

in Cpdf at line 2652
public PRVTgetTextPosition($x, $y, $angle, $size, $wa, $text)

given a start position and information about how text is to be laid out, calculate where on the page the text will end

Parameters

$x
$y
$angle
$size
$wa
$text

in Cpdf at line 2675
public PRVTcheckTextDirective($text, $i, $f, $final)

wrapper function for PRVTcheckTextDirective1

Parameters

$text
$i
$f
$final

in Cpdf at line 2691
public PRVTcheckTextDirective1($text, $i, $f, $final, $x, $y, $size, $angle, $wordSpaceAdjust)

checks if the text stream contains a control directive if so then makes some changes and returns the number of characters involved in the directive this has been re-worked to include everything neccesary to fins the current writing point, so that the location can be sent to the callback function if required if the directive does not require a font change, then $f should be set to 0

Parameters

$text
$i
$f
$final
$x
$y
$size
$angle
$wordSpaceAdjust

in Cpdf at line 2907
public addText($x, $y, $size, $text, $angle, $wordSpaceAdjust)

add text to the document, at a specified location, size and angle on the page

\return array( 'height' => )

Parameters

$x
$y
$size
$text
$angle
$wordSpaceAdjust

in Cpdf at line 3044
public getTextWidth($size, $text)

calculate how wide a given text string will be on a page, at a given size.

this can be called externally, but is alse used by the other class functions

Parameters

$size
$text

in Cpdf at line 3111
public PRVTadjustWrapText($text, $actual, $width, $x, $adjust, $justification)

do a part of the calculation for sorting out the justification of the text

Parameters

$text
$actual
$width
$x
$adjust
$justification

in Cpdf at line 3151
public addTextWrap($x, $y, $width, $size, $text, $justification = 'left', $angle, $test)

add text to the page, but ensure that it fits within a certain width if it does not fit then put in as much as possible, splitting at word boundaries and return the remainder.

justification and angle can also be specified for the text

return array ('text' => , 'width' => , 'height' => )

Parameters

$x
$y
$width
$size
$text
$justification
$angle
$test

in Cpdf at line 3340
public saveState($pageEnd)

this will be called at a new page to return the state to what it was on the end of the previous page, before the stack was closed down This is to get around not being able to have open 'q' across pages

Parameters

$pageEnd

in Cpdf at line 3366
public restoreState($pageEnd)

restore a previously saved state

Parameters

$pageEnd

in Cpdf at line 3387
public openObject()

make a loose object, the output will go into this object, until it is closed, then will revert to the current one.

this object will not appear until it is included within a page. the function will return the object number

in Cpdf at line 3404
public reopenObject($id)

open an existing object for editing

Parameters

$id

in Cpdf at line 3420
public closeObject()

close an object

in Cpdf at line 3437
public stopObject($id)

stop an object from appearing on pages from this point on

Parameters

$id

in Cpdf at line 3450
public addObject($id, $options = 'add')

after an object has been created, it wil only show if it has been added, using this function.

Parameters

$id
$options

in Cpdf at line 3502
public addInfo($label, $value)

add content to the documents info object

Parameters

$label
$value

in Cpdf at line 3524
public setPreferences($label, $value)

set the viewer preferences of the document, it is up to the browser to obey these.

Parameters

$label
$value

in Cpdf at line 3545
public PRVT_getBytes($data, $pos, $num)

extract an integer from a position in a byte stream

Parameters

$data
$pos
$num

in Cpdf at line 3563
public addPngFromFile($file, $x, $y, $w, $h)

add a PNG image into the document, from a file this should work with remote files

\return true if adding image succeded

Parameters

$file
$x
$y
$w
$h

in Cpdf at line 3796
public addJpegFromFile($img, $x, $y, $w, $h)

add a JPEG image into the document, from a file

Parameters

$img
$x
$y
$w
$h

in Cpdf at line 3850
public addImage($img, $x, $y, $w, $h, $quality = 75)

add an image into the document, from a GD object this function is not all that reliable, and I would probably encourage people to use the file based functions

Parameters

$img
$x
$y
$w
$h
$quality

in Cpdf at line 3920
public addJpegImage_common($data, $x, $y, $w, $h, $imageWidth, $imageHeight, $channels = 3)

common code used by the two JPEG adding functions

Parameters

$data
$x
$y
$w
$h
$imageWidth
$imageHeight
$channels

in Cpdf at line 3943
public openHere($style, $a, $b, $c)

specify where the document should open when it first starts

Parameters

$style
$a
$b
$c

in Cpdf at line 3966
public addDestination($label, $style, $a, $b, $c)

create a labelled destination within the document

Parameters

$label
$style
$a
$b
$c

in Cpdf at line 3985
public setFontFamily($family, $options = '')

define font families, this is used to initialize the font families for the default fonts and for the user to add new ones for their fonts.

The default bahavious can be overridden should that be desired.

Parameters

$family
$options

in Cpdf at line 4028
public addMessage($message)

used to add messages for use in debugging

Parameters

$message

in Cpdf at line 4036
public transaction($action)

a few functions which should allow the document to be treated transactionally.

Parameters

$action

in Cpdf at line 4098
public compareCMYK($cmykArray1, $cmykArray2)

Parameters

$cmykArray1
$cmykArray2

in Cpdf at line 4111
public pushTextState($newState)

Parameters

$newState

in Cpdf at line 4121
public popTextState()

at line 27
public Cezpdf($paper = 'a4', $orientation = 'portrait')

Parameters

$paper
$orientation

at line 147
public ezSetCmMargins($top, $bottom, $left, $right)

Parameters

$top
$bottom
$left
$right

at line 160
public setFontSize($size)

Parameters

$size

at line 169
public setJustification($align)

Parameters

$align

at line 178
public justification()

at line 187
public fontSize()

at line 194
public ezColumnsStart($options = array())

Parameters

$options

at line 228
public ezColumnsStop()

at line 240
public ezInsertMode($status = 1, $pageNum = 1, $pos = 'before')

Parameters

$status
$pageNum
$pos

at line 260
public ezNewPage()

at line 315
public ezSetMargins($top, $bottom, $left, $right)

Parameters

$top
$bottom
$left
$right

at line 340
public ezGetCurrentPageNumber()

at line 348
public ezStartPageNumbers($x, $y, $size, $pos = 'left', $pattern = '{PAGENUM} of {TOTALPAGENUM}', $num = '')

Parameters

$x
$y
$size
$pos
$pattern
$num

at line 378
public ezWhatPageNumber($pageNum, $i)

Parameters

$pageNum
$i

at line 417
public ezStopPageNumbers($stopTotal, $next, $i)

Parameters

$stopTotal
$next
$i

at line 459
public ezPRVTpageNumberSearch($lbl, $tmp)

Parameters

$lbl
$tmp

at line 483
public ezPRVTaddPageNumbers()

at line 577
public ezPRVTcleanUp()

at line 584
public ezStream($options = '')

Parameters

$options

at line 592
public ezOutput($options)

Parameters

$options

at line 600
public ezSetY($y)

Parameters

$y

at line 614
public ezSetDy($dy, $mod = '')

Parameters

$dy
$mod

at line 636
public ezPrvtTableDrawLines($pos, $gap, $x0, $x1, $y0, $y1, $y2, $col, $inner, $outer, $opt = 1)

Parameters

$pos
$gap
$x0
$x1
$y0
$y1
$y2
$col
$inner
$outer
$opt

at line 677
public ezPrvtTableColumnHeadings($cols, $pos, $maxWidth, $height, $decender, $gap, $size, $y, $optionsAll = array())

Parameters

$cols
$pos
$maxWidth
$height
$decender
$gap
$size
$y
$optionsAll

at line 762
public eZGetMaxWordWidth($size, $text)

Parameters

$size
$text

at line 778
public ezPrvtGetTextWidth($size, $text)

Parameters

$size
$text

at line 808
public ezShadedRectangle($x1, $y1, $width, $height, $col1, $col2, $direction = 'vertical')

Draw a shaded rectangle

direction is optional and set to vertical by default

\param x1
\param y1
\param width
\param height
\param col1
\param col2
\param direction ('vertical', 'horizontal', or angle)

Parameters

$x1
$y1
$width
$height
$col1
$col2
$direction

at line 820
public ezProcessText($text)

Parameters

$text

at line 831
public ezText($text, $size, $options = array(), $test)

Parameters

$text
$size
$options
$test

at line 1020
public ezImage($image, $pad = 5, $width, $resize = 'full', $just = 'center', $border = '')

Parameters

$image
$pad
$width
$resize
$just
$border

at line 1151
public loadTemplate($templateFile)

Parameters

$templateFile

at line 1196
public execTemplate($id, $data = array(), $options = array())

Parameters

$id
$data
$options

Parameters

$info

Parameters

$info
$internal

at line 1270
public uline($info)

Parameters

$info

at line 1315
public strike($info)

Parameters

$info

at line 1359
public lineHeight($options = array())

Get current line height

Parameters

$options

at line 1392
public rightMargin($yOffset = false)

Parameters

$yOffset

at line 1417
public leftMargin($yOffset = false)

Parameters

$yOffset

at line 1446
public setLimitedLeftMargin($startY, $stopY, $leftMargin)

Parameters

$startY
$stopY
$leftMargin

at line 1460
public setLimitedRightMargin($startY, $stopY, $rightMargin)

Parameters

$startY
$stopY
$rightMargin