CPdf
in package
Table of Contents
- $addLooseObjects : mixed
- array contains infomation about how the loose objects are to be added to the document
- $arc4 : string
- $arc4_objnum : int
- $callback : array<string|int, mixed>
- $catalogId : int
- $charSpaceAdjust : float
- $checkpoint : array<string|int, mixed>
- $currentBaseFont : string
- $currentColor : array<string|int, mixed>
- $currentContents : int
- $currentFillTransparency : mixed
- array Current fill transparency (partial graphics state)
- $currentFont : mixed
- $currentFontNum : int
- $currentLineStyle : string
- $currentLineTransparency : array<string|int, mixed>
- $currentNode : int
- $currentPage : int
- $currentStrokeColor : array<string|int, mixed>
- $currentTextState : string
- $defaultFont : string
- $destinations : array<string|int, mixed>
- $encrypted : bool
- $encryptionKey : string
- $fileIdentifier : string
- $fillRule : string
- $firstPageId : int
- $fontcache : string
- $fontcacheVersion : int
- $fontFamilies : array<string|int, mixed>
- $fonts : array<string|int, mixed>
- $imagelist : array<string|int, mixed>
- $infoObject : int
- $isUnicode : bool
- $javascript : string
- $looseObjects : mixed
- an array which contains information about the objects which are not firmly attached to pages these have been added with the addObject function
- $messages : string
- $nCallback : int
- $nStack : int
- $nStateStack : int
- $numFonts : int
- $numImages : int
- $numObj : int
- $numPages : int
- $objects : array<string|int, mixed>
- $options : array<string|int, mixed>
- $procsetObjectId : int
- $stack : array<string|int, mixed>
- $stateStack : array<string|int, mixed>
- $tmp : string
- $wordSpaceAdjust : float
- $compressionReady : bool
- $coreFonts : array<string|int, mixed>
- $currentPageSize : array<string|int, mixed>
- $stringSubsets : array<string|int, mixed>
- $targetEncoding : string
- $numStates : int
- __construct() : mixed
- Class constructor This will start a new document
- addDestination() : mixed
- create a labelled destination within the document
- addImagePng() : mixed
- add a PNG image into the document, from a GD object this should work with remote files
- addInfo() : mixed
- add content to the documents info object
- addInternalLink() : mixed
- add a link in the document to an internal destination (ie. within the document)
- addJavascript() : void
- Add JavaScript code to the PDF document
- addJpegFromFile() : mixed
- add a JPEG image into the document, from a file
- addLink() : mixed
- add a link in the document to an external URL
- addMessage() : mixed
- used to add messages for use in debugging
- addObject() : mixed
- after an object has been created, it wil only show if it has been added, using this function.
- addPngFromBuf() : mixed
- add a PNG image into the document, from a memory buffer of the file
- addPngFromFile() : mixed
- add a PNG image into the document, from a file this should work with remote files
- addText() : mixed
- add text to the document, at a specified location, size and angle on the page
- ARC4() : mixed
- ARC4 encrypt a text string
- ARC4_init() : mixed
- initialize the ARC4 encryption
- checkAllHere() : mixed
- should be used for internal checks, not implemented as yet
- closeObject() : mixed
- close an object
- closePath() : mixed
- concatMatches() : mixed
- curveTo() : mixed
- draw a bezier curve based on 4 control points
- ellipse() : mixed
- draw an ellipse note that the part and filled ellipse are just special cases of this function
- encryptInit() : mixed
- initialize the encryption for processing a particular object
- endPath() : mixed
- fill() : mixed
- fillStroke() : mixed
- filterText() : mixed
- 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
- getFirstPageId() : mixed
- 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.
- getFontDescender() : mixed
- return the font descender, 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
- getFontHeight() : mixed
- return the height in units of the current font in the given size
- getFontXHeight() : mixed
- getTextWidth() : mixed
- calculate how wide a given text string will be on a page, at a given size.
- image_iscached() : mixed
- Check if image already added to pdf image directory.
- lineTo() : mixed
- md5_16() : mixed
- calculate the 16 byte version of the 128 bit md5 digest of the string
- moveTo() : mixed
- newPage() : mixed
- add a new page to the document this also makes the new page the current active object
- openHere() : mixed
- specify where the document should open when it first starts
- openObject() : mixed
- make a loose object, the output will go into this object, until it is closed, then will revert to the current one.
- output() : mixed
- return the pdf stream as a string returned from the function
- quadTo() : mixed
- draw a bezier curve based on 4 control points
- rect() : mixed
- registerText() : mixed
- add text to the document, at a specified location, size and angle on the page
- reopenObject() : mixed
- open an existing object for editing
- restore() : mixed
- restore the last graphic state
- restoreSerializedObject() : mixed
- restore an object from its stored representation. returns its new object id.
- restoreState() : mixed
- restore a previously saved state
- rotate() : mixed
- rotate
- save() : mixed
- save the current graphic state
- saveState() : mixed
- 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
- scale() : mixed
- scale
- selectFont() : mixed
- 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.
- serializeObject() : mixed
- return a storable representation of a specific object
- setColor() : mixed
- sets the color for fill operations
- setEncryption() : mixed
- set the encryption of the document can be used to turn it on and/or set the passwords which it will have.
- setFillRule() : mixed
- sets the color for fill operations
- setFillTransparency() : mixed
- Set current blend mode & opacity for filled objects.
- setFontFamily() : mixed
- 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.
- setGraphicsState() : mixed
- Set the graphics state for compositions
- setLineStyle() : mixed
- this sets the line drawing style.
- setLineTransparency() : mixed
- Set current blend mode & opacity for lines.
- setPreferences() : mixed
- set the viewer preferences of the document, it is up to the browser to obey these.
- setStrokeColor() : mixed
- sets the color for stroke operations
- skew() : mixed
- skew
- stopObject() : mixed
- stop an object from appearing on pages from this point on
- stream() : mixed
- output the pdf code, streaming it to the browser the relevant headers are set so that hopefully the browser will recognise it
- stroke() : mixed
- toUpper() : string
- Callback method used by smallCaps
- transaction() : mixed
- a few functions which should allow the document to be treated transactionally.
- transform() : mixed
- apply graphic transformations
- translate() : mixed
- translate
- addImagePngAlpha() : mixed
- o_action() : mixed
- an action object, used to link to URLS initially
- o_annotation() : mixed
- an annotation object, this will add an annotation to the current page.
- o_catalog() : mixed
- define the document catalog, the overall controller for the document
- o_contents() : mixed
- the contents objects hold all of the content which appears on pages
- o_destination() : mixed
- Destination object, used to specify the location for the user to jump to, presently on opening
- o_embedjs() : mixed
- o_encryption() : mixed
- encryption object.
- o_extGState() : mixed
- graphics state object
- o_font() : mixed
- an object to hold the font description
- o_fontDescendentCID() : mixed
- a descendent cid font, needed for unicode fonts
- o_fontDescriptor() : mixed
- a font descriptor, needed for including additional fonts
- o_fontEncoding() : mixed
- the font encoding
- o_fontGIDtoCIDMap() : mixed
- a font glyph to character map, needed for unicode fonts
- o_image() : mixed
- an image object, will be an XObject in the document, includes description and data
- o_info() : mixed
- define the document information
- o_javascript() : mixed
- o_outlines() : mixed
- define the outlines in the doc, empty for now
- o_page() : mixed
- a page object, it also creates a contents object to hold its contents
- o_pages() : mixed
- object which is a parent to the pages in the document
- o_procset() : mixed
- the document procset, solves some problems with printing to old PS printers
- o_viewerPreferences() : mixed
- set the viewer preferences
- addContent() : mixed
- add content to the currently active object
- addJpegImage_common() : mixed
- common code used by the two JPEG adding functions
- getBytes() : mixed
- extract an integer from a position in a byte stream
- getTextPosition() : mixed
- given a start position and information about how text is to be laid out, calculate where on the page the text will end
- newDocument() : mixed
- 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
- openFont() : mixed
- open the font file and return a php structure containing it.
- setCurrentFont() : mixed
- sets up the current font, based on the font families, and the current text state note that this system is quite flexible, a bold-italic font can be completely different to a italic-bold font, and even bold-bold 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.
Properties
$addLooseObjects
array contains infomation about how the loose objects are to be added to the document
public
mixed
$addLooseObjects
= array()
$arc4
public
string
$arc4
= ''
The ancryption array for the document encryption is stored here
$arc4_objnum
public
int
$arc4_objnum
= 0
The object Id of the encryption information
$callback
public
array<string|int, mixed>
$callback
= array()
Array which forms a stack to keep track of nested callback functions
$catalogId
public
int
$catalogId
The objectId (number within the objects array) of the document catalog
$charSpaceAdjust
public
float
$charSpaceAdjust
= 0
Used to track the last used value of the inter-letter spacing, this is so that it is known when the spacing is changed.
$checkpoint
public
array<string|int, mixed>
$checkpoint
= ''
Store the stack for the transaction commands, each item in here is a record of the values of all the publiciables 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.
$currentBaseFont
public
string
$currentBaseFont
= ''
The current base font
$currentColor
public
array<string|int, mixed>
$currentColor
= null
Current color for fill operations, defaults to inactive value, all three components should be between 0 and 1 inclusive when active
$currentContents
public
int
$currentContents
Object number of the currently active contents block
$currentFillTransparency
array Current fill transparency (partial graphics state)
public
mixed
$currentFillTransparency
= array("mode" => "Normal", "opacity" => 1.0)
$currentFont
public
mixed
$currentFont
= ''
Tags
$currentFontNum
public
int
$currentFontNum
= 0
The number of the current font within the font array
$currentLineStyle
public
string
$currentLineStyle
= ''
Current style that lines are drawn in
$currentLineTransparency
public
array<string|int, mixed>
$currentLineTransparency
= array("mode" => "Normal", "opacity" => 1.0)
Current line transparency (partial graphics state)
$currentNode
public
int
$currentNode
$currentPage
public
int
$currentPage
Object number of the current page
$currentStrokeColor
public
array<string|int, mixed>
$currentStrokeColor
= null
Current color for stroke operations (lines etc.)
$currentTextState
public
string
$currentTextState
= ''
Track if the current font is bolded or italicised
$defaultFont
public
string
$defaultFont
= './fonts/Helvetica.afm'
The default font metrics file to use if no other font has been loaded. The path to the directory containing the font metrics should be included
$destinations
public
array<string|int, mixed>
$destinations
= array()
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
$encrypted
public
bool
$encrypted
= false
A flag to say if a document is to be encrypted or not
$encryptionKey
public
string
$encryptionKey
= ''
The encryption key for the encryption of all the document content (structure is not encrypted)
$fileIdentifier
public
string
$fileIdentifier
= ''
The file identifier, used to uniquely identify a pdf document
$fillRule
public
string
$fillRule
= "nonzero"
Fill rule (nonzero or evenodd)
$firstPageId
public
int
$firstPageId
The objectId of the first page of the document
$fontcache
public
string
$fontcache
= ''
Folder for php serialized formats of font metrics files. If empty string, use same folder as original metrics files. This can be passed in from class creator. If this folder does not exist or is not writable, Cpdf will be much slower. Because of potential trouble with php safe mode, folder cannot be created at runtime.
$fontcacheVersion
public
int
$fontcacheVersion
= 6
The version of the font metrics cache file. This value must be manually incremented whenever the internal font data structure is modified.
$fontFamilies
public
array<string|int, mixed>
$fontFamilies
= array()
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. the value of this array is initialised in the constuctor function.
$fonts
public
array<string|int, mixed>
$fonts
= array()
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
$imagelist
public
array<string|int, mixed>
$imagelist
= array()
Table of Image origin filenames and image labels which were already added with o_image(). Allows to merge identical images
$infoObject
public
int
$infoObject
= 0
The objectId of the information object for the document this contains authorship, title etc.
$isUnicode
public
bool
$isUnicode
= false
Whether the text passed in should be treated as Unicode or just local character set.
$javascript
public
string
$javascript
= ''
the JavaScript code of the document
$looseObjects
an array which contains information about the objects which are not firmly attached to pages these have been added with the addObject function
public
mixed
$looseObjects
= array()
$messages
public
string
$messages
= ''
Messages are stored here during processing, these can be selected afterwards to give some useful debug information
$nCallback
public
int
$nCallback
= 0
The number of callback functions in the callback array
$nStack
public
int
$nStack
= 0
Number of elements within the object Id storage stack
$nStateStack
public
int
$nStateStack
= 0
Number of elements within the state stack
$numFonts
public
int
$numFonts
= 0
Number of fonts within the system
$numImages
public
int
$numImages
= 0
Number of images being tracked within the document
$numObj
public
int
$numObj
= 0
The current number of pdf objects in the document
$numPages
public
int
$numPages
= 0
Number of page objects within the document
$objects
public
array<string|int, mixed>
$objects
= array()
This array contains all of the pdf objects, ready for final assembly
$options
public
array<string|int, mixed>
$options
= array('compression' => true)
An array containing options about the document it defaults to turning on the compression of the objects
$procsetObjectId
public
int
$procsetObjectId
The object Id of the procset object
$stack
public
array<string|int, mixed>
$stack
= array()
Object Id storage stack
$stateStack
public
array<string|int, mixed>
$stateStack
= array()
An array which is used to save the state of the document, mainly the colors and styles it is used to temporarily change to another state, the change back to what it was before
$tmp
public
string
$tmp
= ''
Temporary folder. If empty string, will attempty system tmp folder. This can be passed in from class creator. Only used for conversion of gd images to jpeg images.
$wordSpaceAdjust
public
float
$wordSpaceAdjust
= 0
Used to track the last used value of the inter-word spacing, this is so that it is known when the spacing is changed.
$compressionReady
protected
bool
$compressionReady
= false
whether the compression is possible
$coreFonts
protected
static array<string|int, mixed>
$coreFonts
= array('courier', 'courier-bold', 'courier-oblique', 'courier-boldoblique', 'helvetica', 'helvetica-bold', 'helvetica-oblique', 'helvetica-boldoblique', 'times-roman', 'times-bold', 'times-italic', 'times-bolditalic', 'symbol', 'zapfdingbats')
The list of the core fonts
$currentPageSize
protected
array<string|int, mixed>
$currentPageSize
= array("width" => 0, "height" => 0)
Current page size
$stringSubsets
protected
array<string|int, mixed>
$stringSubsets
= array()
All the chars that will be required in the font subsets
$targetEncoding
protected
static string
$targetEncoding
= 'iso-8859-1'
The target internal encoding
$numStates
private
int
$numStates
= 0
Number of graphic state resources used
Methods
__construct()
Class constructor This will start a new document
public
__construct([array<string|int, mixed> $pageSize = array(0, 0, 612, 792) ][, bool $isUnicode = false ][, string $fontcache = '' ][, string $tmp = '' ]) : mixed
Parameters
- $pageSize : array<string|int, mixed> = array(0, 0, 612, 792)
-
Array of 4 numbers, defining the bottom left and upper right corner of the page. first two are normally zero.
- $isUnicode : bool = false
-
Whether text will be treated as Unicode or not.
- $fontcache : string = ''
-
The font cache folder
- $tmp : string = ''
-
The temporary folder
Return values
mixed —addDestination()
create a labelled destination within the document
public
addDestination(mixed $label, mixed $style, mixed $a, mixed $b, mixed $c) : mixed
Parameters
- $label : mixed
- $style : mixed
- $a : mixed
- $b : mixed
- $c : mixed
Return values
mixed —addImagePng()
add a PNG image into the document, from a GD object this should work with remote files
public
addImagePng(string $file, float $x, float $y[, float $w = 0.0 ][, float $h = 0.0 ], resource &$img[, bool $is_mask = false ][, bool $mask = null ]) : mixed
Parameters
- $file : string
-
The PNG file
- $x : float
-
X position
- $y : float
-
Y position
- $w : float = 0.0
-
Width
- $h : float = 0.0
-
Height
- $img : resource
-
A GD resource
- $is_mask : bool = false
-
true if the image is a mask
- $mask : bool = null
-
true if the image is masked
Return values
mixed —addInfo()
add content to the documents info object
public
addInfo(mixed $label, mixed $value) : mixed
Parameters
- $label : mixed
- $value : mixed
Return values
mixed —addInternalLink()
add a link in the document to an internal destination (ie. within the document)
public
addInternalLink(mixed $label, mixed $x0, mixed $y0, mixed $x1, mixed $y1) : mixed
Parameters
- $label : mixed
- $x0 : mixed
- $y0 : mixed
- $x1 : mixed
- $y1 : mixed
Return values
mixed —addJavascript()
Add JavaScript code to the PDF document
public
addJavascript(string $code) : void
Parameters
- $code : string
Return values
void —addJpegFromFile()
add a JPEG image into the document, from a file
public
addJpegFromFile(mixed $img, mixed $x, mixed $y, mixed $w, mixed $h) : mixed
Parameters
- $img : mixed
- $x : mixed
- $y : mixed
- $w : mixed
- $h : mixed
Return values
mixed —addLink()
add a link in the document to an external URL
public
addLink(mixed $url, mixed $x0, mixed $y0, mixed $x1, mixed $y1) : mixed
Parameters
- $url : mixed
- $x0 : mixed
- $y0 : mixed
- $x1 : mixed
- $y1 : mixed
Return values
mixed —addMessage()
used to add messages for use in debugging
public
addMessage(mixed $message) : mixed
Parameters
- $message : mixed
Return values
mixed —addObject()
after an object has been created, it wil only show if it has been added, using this function.
public
addObject(mixed $id[, mixed $options = 'add' ]) : mixed
Parameters
- $id : mixed
- $options : mixed = 'add'
Return values
mixed —addPngFromBuf()
add a PNG image into the document, from a memory buffer of the file
public
addPngFromBuf(mixed $file, mixed $x, mixed $y[, mixed $w = 0.0 ][, mixed $h = 0.0 ], mixed &$data[, mixed $is_mask = false ][, mixed $mask = null ]) : mixed
Parameters
- $file : mixed
- $x : mixed
- $y : mixed
- $w : mixed = 0.0
- $h : mixed = 0.0
- $data : mixed
- $is_mask : mixed = false
- $mask : mixed = null
Return values
mixed —addPngFromFile()
add a PNG image into the document, from a file this should work with remote files
public
addPngFromFile(mixed $file, mixed $x, mixed $y, mixed $w, mixed $h) : mixed
Parameters
- $file : mixed
- $x : mixed
- $y : mixed
- $w : mixed
- $h : mixed
Return values
mixed —addText()
add text to the document, at a specified location, size and angle on the page
public
addText(mixed $x, mixed $y, mixed $size, mixed $text, mixed $angle, mixed $wordSpaceAdjust, mixed $charSpaceAdjust[, mixed $smallCaps = false ]) : mixed
Parameters
- $x : mixed
- $y : mixed
- $size : mixed
- $text : mixed
- $angle : mixed
- $wordSpaceAdjust : mixed
- $charSpaceAdjust : mixed
- $smallCaps : mixed = false
Return values
mixed —ARC4()
ARC4 encrypt a text string
public
ARC4(mixed $text) : mixed
Parameters
- $text : mixed
Return values
mixed —ARC4_init()
initialize the ARC4 encryption
public
ARC4_init([mixed $key = '' ]) : mixed
Parameters
- $key : mixed = ''
Return values
mixed —checkAllHere()
should be used for internal checks, not implemented as yet
public
checkAllHere() : mixed
Return values
mixed —closeObject()
close an object
public
closeObject() : mixed
Return values
mixed —closePath()
public
closePath() : mixed
Return values
mixed —concatMatches()
public
concatMatches(mixed $matches) : mixed
Parameters
- $matches : mixed
Return values
mixed —curveTo()
draw a bezier curve based on 4 control points
public
curveTo(mixed $x1, mixed $y1, mixed $x2, mixed $y2, mixed $x3, mixed $y3) : mixed
Parameters
- $x1 : mixed
- $y1 : mixed
- $x2 : mixed
- $y2 : mixed
- $x3 : mixed
- $y3 : mixed
Return values
mixed —ellipse()
draw an ellipse note that the part and filled ellipse are just special cases of this function
public
ellipse(mixed $x0, mixed $y0, mixed $r1, mixed $r2, mixed $angle[, mixed $nSeg = 8 ], mixed $astart[, mixed $afinish = 360 ][, mixed $close = true ][, mixed $fill = false ][, mixed $stroke = true ][, mixed $incomplete = false ]) : mixed
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 from $astart to $afinish, measured in degrees, running anti-clockwise from the right hand side of the ellipse. 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 : mixed
- $y0 : mixed
- $r1 : mixed
- $r2 : mixed
- $angle : mixed
- $nSeg : mixed = 8
- $astart : mixed
- $afinish : mixed = 360
- $close : mixed = true
- $fill : mixed = false
- $stroke : mixed = true
- $incomplete : mixed = false
Return values
mixed —encryptInit()
initialize the encryption for processing a particular object
public
encryptInit(mixed $id) : mixed
Parameters
- $id : mixed
Return values
mixed —endPath()
public
endPath() : mixed
Return values
mixed —fill()
public
fill() : mixed
Return values
mixed —fillStroke()
public
fillStroke() : mixed
Return values
mixed —filterText()
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
public
filterText(mixed $text[, mixed $bom = true ][, mixed $convert_encoding = true ]) : mixed
Parameters
- $text : mixed
- $bom : mixed = true
- $convert_encoding : mixed = true
Tags
Return values
mixed —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.
public
getFirstPageId() : mixed
Return values
mixed —getFontDescender()
return the font descender, 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
public
getFontDescender(mixed $size) : mixed
Parameters
- $size : mixed
Return values
mixed —getFontHeight()
return the height in units of the current font in the given size
public
getFontHeight(mixed $size) : mixed
Parameters
- $size : mixed
Return values
mixed —getFontXHeight()
public
getFontXHeight(mixed $size) : mixed
Parameters
- $size : mixed
Return values
mixed —getTextWidth()
calculate how wide a given text string will be on a page, at a given size.
public
getTextWidth(mixed $size, mixed $text, mixed $word_spacing, mixed $char_spacing) : mixed
this can be called externally, but is also used by the other class functions
Parameters
- $size : mixed
- $text : mixed
- $word_spacing : mixed
- $char_spacing : mixed
Return values
mixed —image_iscached()
Check if image already added to pdf image directory.
public
image_iscached(mixed $imgname) : mixed
If yes, need not to create again (pass empty data)
Parameters
- $imgname : mixed
Return values
mixed —lineTo()
public
lineTo(mixed $x, mixed $y) : mixed
Parameters
- $x : mixed
- $y : mixed
Return values
mixed —md5_16()
calculate the 16 byte version of the 128 bit md5 digest of the string
public
md5_16(mixed $string) : mixed
Parameters
- $string : mixed
Return values
mixed —moveTo()
public
moveTo(mixed $x, mixed $y) : mixed
Parameters
- $x : mixed
- $y : mixed
Return values
mixed —newPage()
add a new page to the document this also makes the new page the current active object
public
newPage(mixed $insert, mixed $id[, mixed $pos = 'after' ]) : mixed
Parameters
- $insert : mixed
- $id : mixed
- $pos : mixed = 'after'
Return values
mixed —openHere()
specify where the document should open when it first starts
public
openHere(mixed $style, mixed $a, mixed $b, mixed $c) : mixed
Parameters
- $style : mixed
- $a : mixed
- $b : mixed
- $c : mixed
Return values
mixed —openObject()
make a loose object, the output will go into this object, until it is closed, then will revert to the current one.
public
openObject() : mixed
this object will not appear until it is included within a page. the function will return the object number
Return values
mixed —output()
return the pdf stream as a string returned from the function
public
output([mixed $debug = false ]) : mixed
Parameters
- $debug : mixed = false
Return values
mixed —quadTo()
draw a bezier curve based on 4 control points
public
quadTo(mixed $cpx, mixed $cpy, mixed $x, mixed $y) : mixed
Parameters
- $cpx : mixed
- $cpy : mixed
- $x : mixed
- $y : mixed
Return values
mixed —rect()
public
rect(mixed $x1, mixed $y1, mixed $width, mixed $height) : mixed
Parameters
- $x1 : mixed
- $y1 : mixed
- $width : mixed
- $height : mixed
Return values
mixed —registerText()
add text to the document, at a specified location, size and angle on the page
public
registerText(mixed $font, mixed $text) : mixed
Parameters
- $font : mixed
- $text : mixed
Return values
mixed —reopenObject()
open an existing object for editing
public
reopenObject(mixed $id) : mixed
Parameters
- $id : mixed
Return values
mixed —restore()
restore the last graphic state
public
restore() : mixed
Return values
mixed —restoreSerializedObject()
restore an object from its stored representation. returns its new object id.
public
restoreSerializedObject(mixed $obj) : mixed
Parameters
- $obj : mixed
Return values
mixed —restoreState()
restore a previously saved state
public
restoreState(mixed $pageEnd) : mixed
Parameters
- $pageEnd : mixed
Return values
mixed —rotate()
rotate
public
rotate(float $angle, float $x, float $y) : mixed
Parameters
- $angle : float
-
angle in degrees for counter-clockwise rotation
- $x : float
-
Origin abscisse
- $y : float
-
Origin ordinate
Return values
mixed —save()
save the current graphic state
public
save() : mixed
Return values
mixed —saveState()
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
public
saveState(mixed $pageEnd) : mixed
Parameters
- $pageEnd : mixed
Return values
mixed —scale()
scale
public
scale(float $s_x, float $s_y, float $x, float $y) : mixed
Parameters
- $s_x : float
-
scaling factor for width as percent
- $s_y : float
-
scaling factor for height as percent
- $x : float
-
Origin abscisse
- $y : float
-
Origin ordinate
Return values
mixed —selectFont()
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.
public
selectFont(mixed $fontName[, mixed $encoding = '' ][, mixed $set = true ]) : mixed
Parameters
- $fontName : mixed
- $encoding : mixed = ''
- $set : mixed = true
Return values
mixed —serializeObject()
return a storable representation of a specific object
public
serializeObject(mixed $id) : mixed
Parameters
- $id : mixed
Return values
mixed —setColor()
sets the color for fill operations
public
setColor(mixed $color[, mixed $force = false ]) : mixed
Parameters
- $color : mixed
- $force : mixed = false
Return values
mixed —setEncryption()
set the encryption of the document can be used to turn it on and/or set the passwords which it will have.
public
setEncryption([mixed $userPass = '' ][, mixed $ownerPass = '' ][, mixed $pc = array() ]) : mixed
also the functions that the user will have are set here, such as print, modify, add
Parameters
- $userPass : mixed = ''
- $ownerPass : mixed = ''
- $pc : mixed = array()
Return values
mixed —setFillRule()
sets the color for fill operations
public
setFillRule(mixed $fillRule) : mixed
Parameters
- $fillRule : mixed
Return values
mixed —setFillTransparency()
Set current blend mode & opacity for filled objects.
public
setFillTransparency(string $mode, float $opacity) : mixed
Valid blend modes are:
Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDogde, ColorBurn, HardLight, SoftLight, Difference, Exclusion
Parameters
- $mode : string
-
the blend mode to use
- $opacity : float
-
0.0 fully transparent, 1.0 fully opaque
Return values
mixed —setFontFamily()
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.
public
setFontFamily(mixed $family[, mixed $options = '' ]) : mixed
Parameters
- $family : mixed
- $options : mixed = ''
Return values
mixed —setGraphicsState()
Set the graphics state for compositions
public
setGraphicsState(mixed $parameters) : mixed
Parameters
- $parameters : mixed
Return values
mixed —setLineStyle()
this sets the line drawing style.
public
setLineStyle([mixed $width = 1 ][, mixed $cap = '' ][, mixed $join = '' ][, mixed $dash = '' ], mixed $phase) : mixed
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 : mixed = 1
- $cap : mixed = ''
- $join : mixed = ''
- $dash : mixed = ''
- $phase : mixed
Return values
mixed —setLineTransparency()
Set current blend mode & opacity for lines.
public
setLineTransparency(string $mode, float $opacity) : mixed
Valid blend modes are:
Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDogde, ColorBurn, HardLight, SoftLight, Difference, Exclusion
Parameters
- $mode : string
-
the blend mode to use
- $opacity : float
-
0.0 fully transparent, 1.0 fully opaque
Return values
mixed —setPreferences()
set the viewer preferences of the document, it is up to the browser to obey these.
public
setPreferences(mixed $label, mixed $value) : mixed
Parameters
- $label : mixed
- $value : mixed
Return values
mixed —setStrokeColor()
sets the color for stroke operations
public
setStrokeColor(mixed $color[, mixed $force = false ]) : mixed
Parameters
- $color : mixed
- $force : mixed = false
Return values
mixed —skew()
skew
public
skew(float $angle_x, float $angle_y, float $x, float $y) : mixed
Parameters
- $angle_x : float
- $angle_y : float
- $x : float
-
Origin abscisse
- $y : float
-
Origin ordinate
Return values
mixed —stopObject()
stop an object from appearing on pages from this point on
public
stopObject(mixed $id) : mixed
Parameters
- $id : mixed
Return values
mixed —stream()
output the pdf code, streaming it to the browser the relevant headers are set so that hopefully the browser will recognise it
public
stream([mixed $options = '' ]) : mixed
Parameters
- $options : mixed = ''
Return values
mixed —stroke()
public
stroke() : mixed
Return values
mixed —toUpper()
Callback method used by smallCaps
public
toUpper(array<string|int, mixed> $matches) : string
Parameters
- $matches : array<string|int, mixed>
Return values
string —transaction()
a few functions which should allow the document to be treated transactionally.
public
transaction(mixed $action) : mixed
Parameters
- $action : mixed
Return values
mixed —transform()
apply graphic transformations
public
transform(array<string|int, mixed> $tm) : mixed
Parameters
- $tm : array<string|int, mixed>
-
transformation matrix
Return values
mixed —translate()
translate
public
translate(float $t_x, float $t_y) : mixed
Parameters
- $t_x : float
-
movement to the right
- $t_y : float
-
movement to the bottom
Return values
mixed —addImagePngAlpha()
protected
addImagePngAlpha(mixed $file, mixed $x, mixed $y, mixed $w, mixed $h, mixed $byte) : mixed
Parameters
- $file : mixed
- $x : mixed
- $y : mixed
- $w : mixed
- $h : mixed
- $byte : mixed
Return values
mixed —o_action()
an action object, used to link to URLS initially
protected
o_action(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_annotation()
an annotation object, this will add an annotation to the current page.
protected
o_annotation(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
initially will support just link annotations
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_catalog()
define the document catalog, the overall controller for the document
protected
o_catalog(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_contents()
the contents objects hold all of the content which appears on pages
protected
o_contents(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_destination()
Destination object, used to specify the location for the user to jump to, presently on opening
protected
o_destination(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_embedjs()
protected
o_embedjs(mixed $id, mixed $action) : mixed
Parameters
- $id : mixed
- $action : mixed
Return values
mixed —o_encryption()
encryption object.
protected
o_encryption(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_extGState()
graphics state object
protected
o_extGState(mixed $id, mixed $action[, mixed $options = "" ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ""
Return values
mixed —o_font()
an object to hold the font description
protected
o_font(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_fontDescendentCID()
a descendent cid font, needed for unicode fonts
protected
o_fontDescendentCID(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_fontDescriptor()
a font descriptor, needed for including additional fonts
protected
o_fontDescriptor(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_fontEncoding()
the font encoding
protected
o_fontEncoding(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_fontGIDtoCIDMap()
a font glyph to character map, needed for unicode fonts
protected
o_fontGIDtoCIDMap(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_image()
an image object, will be an XObject in the document, includes description and data
protected
o_image(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_info()
define the document information
protected
o_info(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_javascript()
protected
o_javascript(mixed $id, mixed $action[, mixed $code = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $code : mixed = ''
Return values
mixed —o_outlines()
define the outlines in the doc, empty for now
protected
o_outlines(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_page()
a page object, it also creates a contents object to hold its contents
protected
o_page(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_pages()
object which is a parent to the pages in the document
protected
o_pages(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_procset()
the document procset, solves some problems with printing to old PS printers
protected
o_procset(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —o_viewerPreferences()
set the viewer preferences
protected
o_viewerPreferences(mixed $id, mixed $action[, mixed $options = '' ]) : mixed
Parameters
- $id : mixed
- $action : mixed
- $options : mixed = ''
Return values
mixed —addContent()
add content to the currently active object
private
addContent(mixed $content) : mixed
Parameters
- $content : mixed
Return values
mixed —addJpegImage_common()
common code used by the two JPEG adding functions
private
addJpegImage_common(mixed &$data, mixed $x, mixed $y, mixed $w, mixed $h, mixed $imageWidth, mixed $imageHeight[, mixed $channels = 3 ], mixed $imgname) : mixed
Parameters
- $data : mixed
- $x : mixed
- $y : mixed
- $w : mixed
- $h : mixed
- $imageWidth : mixed
- $imageHeight : mixed
- $channels : mixed = 3
- $imgname : mixed
Return values
mixed —getBytes()
extract an integer from a position in a byte stream
private
getBytes(mixed &$data, mixed $pos, mixed $num) : mixed
Parameters
- $data : mixed
- $pos : mixed
- $num : mixed
Return values
mixed —getTextPosition()
given a start position and information about how text is to be laid out, calculate where on the page the text will end
private
getTextPosition(mixed $x, mixed $y, mixed $angle, mixed $size, mixed $wa, mixed $text) : mixed
Parameters
- $x : mixed
- $y : mixed
- $angle : mixed
- $size : mixed
- $wa : mixed
- $text : mixed
Return values
mixed —newDocument()
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
private
newDocument([mixed $pageSize = array(0, 0, 612, 792) ]) : mixed
Parameters
- $pageSize : mixed = array(0, 0, 612, 792)
Return values
mixed —openFont()
open the font file and return a php structure containing it.
private
openFont(mixed $font) : mixed
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 : mixed
Return values
mixed —setCurrentFont()
sets up the current font, based on the font families, and the current text state note that this system is quite flexible, a bold-italic font can be completely different to a italic-bold font, and even bold-bold 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.
private
setCurrentFont() : mixed
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.