Documentation

Cpdf
in package

Table of Contents

ACROFORM_FIELD_BUTTON  = 'Btn'
ACROFORM_FIELD_CHOICE  = 'Ch'
ACROFORM_FIELD_CHOICE_COMBO  = 0x20000
ACROFORM_FIELD_CHOICE_EDIT  = 0x40000
ACROFORM_FIELD_CHOICE_MULTISELECT  = 0x200000
ACROFORM_FIELD_CHOICE_SORT  = 0x80000
ACROFORM_FIELD_READONLY  = 0x1
ACROFORM_FIELD_REQUIRED  = 0x2
ACROFORM_FIELD_SIG  = 'Sig'
ACROFORM_FIELD_TEXT  = 'Tx'
ACROFORM_FIELD_TEXT_MULTILINE  = 0x1000
ACROFORM_FIELD_TEXT_PASSWORD  = 0x2000
ACROFORM_FIELD_TEXT_RICHTEXT  = 0x10000
ACROFORM_SIG_APPENDONLY  = 0x2
ACROFORM_SIG_SIGNATURESEXISTS  = 0x1
XOBJECT_SUBTYPE_FORM  = 'Form'
$acroFormId  : int
AcroForm objectId
$addLooseObjects  : mixed
array contains information about how the loose objects are to be added to the document
$arc4  : string
$arc4_objnum  : int
$callback  : array<string|int, mixed>
$catalogId  : int
$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
$signatureMaxLen  : int
$stack  : array<string|int, mixed>
$stateStack  : array<string|int, mixed>
$tmp  : string
$byteRange  : array<string|int, mixed>
$compressionReady  : bool
$coreFonts  : array<string|int, mixed>
$currentPageSize  : array<string|int, mixed>
$embeddedFilesId  : int
$indirectReferenceId  : int
$stringSubsets  : array<string|int, mixed>
$targetEncoding  : string
$gstates  : array<string|int, mixed>
$numStates  : int
__construct()  : mixed
Class constructor This will start a new document
addDestination()  : mixed
create a labelled destination within the document
addEmbeddedFile()  : void
Embeds a file inside the PDF
addForm()  : mixed
add form to document
addFormField()  : int
add field to form
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()  : mixed
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
addSignature()  : int
add signature
addSvgFromFile()  : 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
addXObject()  : int
ARC4()  : string
ARC4 encrypt a text string
ARC4_init()  : mixed
initialize the ARC4 encryption
checkAllHere()  : mixed
should be used for internal checks, not implemented as yet
clippingEnd()  : mixed
ends the last clipping shape
clippingRectangle()  : mixed
draw a clipping rectangle, all the elements added after this will be clipped
clippingRectangleRounded()  : mixed
draw a clipping rounded rectangle, all the elements added after this will be clipped
closeObject()  : mixed
close an object
closePath()  : mixed
concatMatches()  : mixed
curve()  : mixed
draw a bezier curve based on 4 control points
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
filledEllipse()  : mixed
draw a filled ellipse
filledRectangle()  : mixed
a filled rectangle, note that it is the width and height of the rectangle which are the secondary parameters, not the coordinates of the upper-right corner
fillStroke()  : mixed
filterText()  : string
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()  : int
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()  : float|int
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()  : float|int
return the height in units of the current font in the given size
getFontXHeight()  : float|int
getTextWidth()  : float|int
calculate how wide a given text string will be on a page, at a given size.
image_iscached()  : bool
Check if image already added to pdf image directory.
line()  : mixed
draw a line from one set of coordinates to another
lineTo()  : mixed
md5_16()  : string
calculate the 16 byte version of the 128 bit md5 digest of the string
moveTo()  : mixed
newPage()  : int
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()  : int
make a loose object, the output will go into this object, until it is closed, then will revert to the current one.
output()  : string
return the pdf stream as a string returned from the function
partEllipse()  : mixed
draw a part of an ellipse
polygon()  : mixed
draw a polygon, the syntax for this is similar to the GD polygon command
quadTo()  : mixed
draw a bezier curve based on 4 control points
rect()  : mixed
draw a rectangle, note that it is the width and height of the rectangle which are the secondary parameters, not the coordinates of the upper-right corner
rectangle()  : mixed
draw a rectangle, note that it is the width and height of the rectangle which are the secondary parameters, not the coordinates of the upper-right corner
registerText()  : mixed
register text for font subsetting
reopenObject()  : mixed
open an existing object for editing
restore()  : mixed
restore the last graphic state
restoreSerializedObject()  : int
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()  : int
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()  : string|null
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.
setFormFieldAppearance()  : mixed
set Field Appearanc (reference)
setFormFieldOpt()  : mixed
set Choice Field option values
setFormFieldRefValue()  : mixed
set Field value (reference)
setFormFieldValue()  : mixed
set Field value
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
setXObjectResource()  : mixed
skew()  : mixed
skew
stopObject()  : mixed
stop an object from appearing on pages from this point on
stream()  : mixed
Streams the PDF to the client.
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
utf8toCodePointsArray()  : array<string|int, mixed>
return array containing codepoints (UTF-8 character values) for the string passed in.
utf8toUtf16BE()  : string
convert UTF-8 to UTF-16 with an additional byte order marker at the front if required.
addImagePngAlpha()  : mixed
getFontSubsettingTag()  : string
o_acroform()  : null|string
o_action()  : null|string
an action object, used to link to URLS initially
o_annotation()  : null|string
an annotation object, this will add an annotation to the current page.
o_catalog()  : string|null
define the document catalog, the overall controller for the document
o_cidSystemInfo()  : null|string
CID system info section, needed for unicode fonts
o_contents()  : null|string
the contents objects hold all of the content which appears on pages
o_destination()  : string|null
Destination object, used to specify the location for the user to jump to, presently on opening
o_embedded_file()  : string|null
o_embedded_file_dictionary()  : mixed
o_embedjs()  : string|null
o_encryption()  : string|null
encryption object.
o_extGState()  : null|string
graphics state object
o_field()  : null|string
o_font()  : string|null
an object to hold the font description
o_fontDescendentCID()  : null|string
a descendent cid font, needed for unicode fonts
o_fontDescriptor()  : null|string
a font descriptor, needed for including additional fonts
o_fontEncoding()  : null|string
the font encoding
o_fontGIDtoCIDMap()  : null|string
a font glyph to character map, needed for unicode fonts
o_image()  : null|string
an image object, will be an XObject in the document, includes description and data
o_indirect_references()  : mixed
o_info()  : null|string
define the document information
o_javascript()  : null|string
o_names()  : mixed
o_outlines()  : string|null
define the outlines in the doc, empty for now
o_page()  : null|string
a page object, it also creates a contents object to hold its contents
o_pages()  : string|null
object which is a parent to the pages in the document
o_procset()  : null|string
the document procset, solves some problems with printing to old PS printers
o_sig()  : null|string
o_toUnicode()  : null|string
A toUnicode section, needed for unicode fonts
o_viewerPreferences()  : string|null
set the viewer preferences
o_xobject()  : string
addContent()  : mixed
add content to the currently active object
addJpegImage_common()  : mixed
common code used by the two JPEG adding functions
getBytes()  : int
extract an integer from a position in a byte stream
getTextPosition()  : array<string|int, 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
initialize 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.
processFont()  : array<string|int, mixed>|false
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 appropriate family one is.

Constants

ACROFORM_FIELD_BUTTON

public mixed ACROFORM_FIELD_BUTTON = 'Btn'

ACROFORM_FIELD_CHOICE

public mixed ACROFORM_FIELD_CHOICE = 'Ch'

ACROFORM_FIELD_CHOICE_COMBO

public mixed ACROFORM_FIELD_CHOICE_COMBO = 0x20000

ACROFORM_FIELD_CHOICE_EDIT

public mixed ACROFORM_FIELD_CHOICE_EDIT = 0x40000

ACROFORM_FIELD_CHOICE_MULTISELECT

public mixed ACROFORM_FIELD_CHOICE_MULTISELECT = 0x200000

ACROFORM_FIELD_CHOICE_SORT

public mixed ACROFORM_FIELD_CHOICE_SORT = 0x80000

ACROFORM_FIELD_READONLY

public mixed ACROFORM_FIELD_READONLY = 0x1

ACROFORM_FIELD_REQUIRED

public mixed ACROFORM_FIELD_REQUIRED = 0x2

ACROFORM_FIELD_SIG

public mixed ACROFORM_FIELD_SIG = 'Sig'

ACROFORM_FIELD_TEXT

public mixed ACROFORM_FIELD_TEXT = 'Tx'

ACROFORM_FIELD_TEXT_MULTILINE

public mixed ACROFORM_FIELD_TEXT_MULTILINE = 0x1000

ACROFORM_FIELD_TEXT_PASSWORD

public mixed ACROFORM_FIELD_TEXT_PASSWORD = 0x2000

ACROFORM_FIELD_TEXT_RICHTEXT

public mixed ACROFORM_FIELD_TEXT_RICHTEXT = 0x10000

ACROFORM_SIG_APPENDONLY

public mixed ACROFORM_SIG_APPENDONLY = 0x2

ACROFORM_SIG_SIGNATURESEXISTS

public mixed ACROFORM_SIG_SIGNATURESEXISTS = 0x1

XOBJECT_SUBTYPE_FORM

public mixed XOBJECT_SUBTYPE_FORM = 'Form'

Properties

$acroFormId

AcroForm objectId

public int $acroFormId

$addLooseObjects

array contains information about how the loose objects are to be added to the document

public mixed $addLooseObjects = []

$arc4

public string $arc4 = ''

The encryption 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 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

$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 = ["mode" => "Normal", "opacity" => 1.0]

$currentFont

public mixed $currentFont = ''
Tags
string

A record of the current font

$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 = ["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 = []

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 = []

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 constructor function.

$fonts

public array<string|int, mixed> $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

$imagelist

public array<string|int, mixed> $imagelist = []

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 = []

$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 = []

This array contains all of the pdf objects, ready for final assembly

$options

public array<string|int, mixed> $options = ['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

$signatureMaxLen

public int $signatureMaxLen = 5000

$stack

public array<string|int, mixed> $stack = []

Object Id storage stack

$stateStack

public array<string|int, mixed> $stateStack = []

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, then change back to what it was before

$tmp

public string $tmp = ''

Temporary folder. If empty string, will attempt system tmp folder. This can be passed in from class creator.

$byteRange

protected array<string|int, mixed> $byteRange = array()

$compressionReady

protected bool $compressionReady = false

whether the compression is possible

$coreFonts

protected static array<string|int, mixed> $coreFonts = ['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 = ["width" => 0, "height" => 0]

Current page size

$embeddedFilesId

protected int $embeddedFilesId = 0

The objectId (number within the objects array)

$indirectReferenceId

protected int $indirectReferenceId = 0

The objectId (number within the objects array) of indirect references (Javascript EmbeddedFiles)

$stringSubsets

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

All the chars that will be required in the font subsets

$targetEncoding

protected static string $targetEncoding = 'Windows-1252'

The target internal encoding

$gstates

private array<string|int, mixed> $gstates = []

Number of graphic state resources used

$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 = [0, 0, 612, 792] ][, bool $isUnicode = false ][, string $fontcache = '' ][, string $tmp = '' ]) : mixed
Parameters
$pageSize : array<string|int, mixed> = [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( $label,  $style, int $a, int $b, int $c) : mixed
Parameters
$label :
$style :
$a : int
$b : int
$c : int
Return values
mixed

addEmbeddedFile()

Embeds a file inside the PDF

public addEmbeddedFile(string $filepath, string $embeddedFilename, string $description) : void
Parameters
$filepath : string

path to the file to store inside the PDF

$embeddedFilename : string

the filename displayed in the list of embedded files

$description : string

a description in the list of embedded files

Return values
void

addForm()

add form to document

public addForm(int $sigFlags[, bool $needAppearances = false ]) : mixed
Parameters
$sigFlags : int
$needAppearances : bool = false
Return values
mixed

addFormField()

add field to form

public addFormField(string $type, string $name,  $x0,  $y0,  $x1,  $y1, int $ff[, float $size = 10.0 ][, array<string|int, mixed> $color = [0, 0, 0] ]) : int
Parameters
$type : string

ACROFORM_FIELD_*

$name : string
$x0 :
$y0 :
$x1 :
$y1 :
$ff : int

Field Flag ACROFORM_FIELD__

$size : float = 10.0
$color : array<string|int, mixed> = [0, 0, 0]
Return values
int

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

Tags
throws
Exception
Return values
mixed

addInfo()

add content to the documents info object

public addInfo( $label, int $value) : mixed
Parameters
$label :
$value : int
Return values
mixed

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

public addInternalLink( $label,  $x0,  $y0,  $x1,  $y1) : mixed
Parameters
$label :
$x0 :
$y0 :
$x1 :
$y1 :
Return values
mixed

addJavascript()

Add JavaScript code to the PDF document

public addJavascript(string $code) : mixed
Parameters
$code : string
Return values
mixed

addJpegFromFile()

add a JPEG image into the document, from a file

public addJpegFromFile( $img,  $x,  $y, int $w, int $h) : mixed
Parameters
$img :
$x :
$y :
$w : int
$h : int
Return values
mixed

add a link in the document to an external URL

public addLink( $url,  $x0,  $y0,  $x1,  $y1) : mixed
Parameters
$url :
$x0 :
$y0 :
$x1 :
$y1 :
Return values
mixed

addMessage()

used to add messages for use in debugging

public addMessage( $message) : mixed
Parameters
$message :
Return values
mixed

addObject()

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

public addObject( $id[, string $options = 'add' ]) : mixed
Parameters
$id :
$options : string = 'add'
Return values
mixed

addPngFromBuf()

add a PNG image into the document, from a memory buffer of the file

public addPngFromBuf( $file,  $x,  $y[, float $w = 0.0 ][, float $h = 0.0 ],  &$data[, bool $is_mask = false ][, null $mask = null ]) : mixed
Parameters
$file :
$x :
$y :
$w : float = 0.0
$h : float = 0.0
$data :
$is_mask : bool = false
$mask : null = null
Return values
mixed

addPngFromFile()

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

public addPngFromFile( $file,  $x,  $y, int $w, int $h) : mixed
Parameters
$file :
$x :
$y :
$w : int
$h : int
Tags
throws
Exception
Return values
mixed

addSignature()

add signature

public addSignature(string $signcert, string $privkey[, string $password = '' ][, string|null $name = null ][, string|null $location = null ][, string|null $reason = null ][, string|null $contactinfo = null ]) : int

$fieldSigId = $cpdf->addFormField(Cpdf::ACROFORM_FIELD_SIG, 'Signature1', 0, 0, 0, 0, 0);

$signatureId = $cpdf->addSignature([ 'signcert' => file_get_contents('dompdf.crt'), 'privkey' => file_get_contents('dompdf.key'), 'password' => 'password', 'name' => 'DomPDF DEMO', 'location' => 'Home', 'reason' => 'First Form', 'contactinfo' => 'info' ]); $cpdf->setFormFieldValue($fieldSigId, "$signatureId 0 R");

Parameters
$signcert : string
$privkey : string
$password : string = ''
$name : string|null = null
$location : string|null = null
$reason : string|null = null
$contactinfo : string|null = null
Return values
int

addSvgFromFile()

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

public addSvgFromFile( $file,  $x,  $y, int $w, int $h) : mixed
Parameters
$file :
$x :
$y :
$w : int
$h : int
Return values
mixed

addText()

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

public addText( $x,  $y,  $size,  $text, int $angle, int $wordSpaceAdjust, int $charSpaceAdjust[, bool $smallCaps = false ]) : mixed
Parameters
$x :
$y :
$size :
$text :
$angle : int
$wordSpaceAdjust : int
$charSpaceAdjust : int
$smallCaps : bool = false
Return values
mixed

addXObject()

public addXObject(string $subtype, int $x, int $y, int $w, int $h) : int
Parameters
$subtype : string
$x : int
$y : int
$w : int
$h : int
Return values
int

ARC4()

ARC4 encrypt a text string

public ARC4( $text) : string
Parameters
$text :
Return values
string

ARC4_init()

initialize the ARC4 encryption

public ARC4_init([string $key = '' ]) : mixed
Parameters
$key : string = ''
Return values
mixed

checkAllHere()

should be used for internal checks, not implemented as yet

public checkAllHere() : mixed
Return values
mixed

clippingEnd()

ends the last clipping shape

public clippingEnd() : mixed
Return values
mixed

clippingRectangle()

draw a clipping rectangle, all the elements added after this will be clipped

public clippingRectangle( $x1,  $y1,  $width,  $height) : mixed
Parameters
$x1 :
$y1 :
$width :
$height :
Return values
mixed

clippingRectangleRounded()

draw a clipping rounded rectangle, all the elements added after this will be clipped

public clippingRectangleRounded( $x1,  $y1,  $w,  $h,  $rTL,  $rTR,  $rBR,  $rBL) : mixed
Parameters
$x1 :
$y1 :
$w :
$h :
$rTL :
$rTR :
$rBR :
$rBL :
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

curve()

draw a bezier curve based on 4 control points

public curve( $x0,  $y0,  $x1,  $y1,  $x2,  $y2,  $x3,  $y3) : mixed
Parameters
$x0 :
$y0 :
$x1 :
$y1 :
$x2 :
$y2 :
$x3 :
$y3 :
Return values
mixed

curveTo()

draw a bezier curve based on 4 control points

public curveTo( $x1,  $y1,  $x2,  $y2,  $x3,  $y3) : mixed
Parameters
$x1 :
$y1 :
$x2 :
$y2 :
$x3 :
$y3 :
Return values
mixed

ellipse()

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

public ellipse( $x0,  $y0,  $r1, int $r2, int $angle[, int $nSeg = 8 ], int $astart[, int $afinish = 360 ][, bool $close = true ][, bool $fill = false ][, bool $stroke = true ][, bool $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 :
$y0 :
$r1 :
$r2 : int
$angle : int
$nSeg : int = 8
$astart : int
$afinish : int = 360
$close : bool = true
$fill : bool = false
$stroke : bool = true
$incomplete : bool = false
Return values
mixed

encryptInit()

initialize the encryption for processing a particular object

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

endPath()

public endPath() : mixed
Return values
mixed

fill()

public fill() : mixed
Return values
mixed

filledEllipse()

draw a filled ellipse

public filledEllipse( $x0,  $y0,  $r1, int $r2, int $angle[, int $nSeg = 8 ], int $astart[, int $afinish = 360 ]) : mixed
Parameters
$x0 :
$y0 :
$r1 :
$r2 : int
$angle : int
$nSeg : int = 8
$astart : int
$afinish : int = 360
Return values
mixed

filledRectangle()

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

public filledRectangle( $x1,  $y1,  $width,  $height) : mixed
Parameters
$x1 :
$y1 :
$width :
$height :
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( $text[, bool $bom = true ][, bool $convert_encoding = true ]) : string
Parameters
$text :
$bom : bool = true
$convert_encoding : bool = true
Tags
access

private

Return values
string

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() : int
Return values
int

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( $size) : float|int
Parameters
$size :
Return values
float|int

getFontHeight()

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

public getFontHeight( $size) : float|int
Parameters
$size :
Return values
float|int

getFontXHeight()

public getFontXHeight( $size) : float|int
Parameters
$size :
Return values
float|int

getTextWidth()

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

public getTextWidth( $size,  $text, int $word_spacing, int $char_spacing) : float|int

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

Parameters
$size :
$text :
$word_spacing : int
$char_spacing : int
Return values
float|int

image_iscached()

Check if image already added to pdf image directory.

public image_iscached( $imgname) : bool

If yes, need not to create again (pass empty data)

Parameters
$imgname :
Return values
bool

line()

draw a line from one set of coordinates to another

public line( $x1,  $y1,  $x2,  $y2[, bool $stroke = true ]) : mixed
Parameters
$x1 :
$y1 :
$x2 :
$y2 :
$stroke : bool = true
Return values
mixed

lineTo()

public lineTo( $x,  $y) : mixed
Parameters
$x :
$y :
Return values
mixed

md5_16()

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

public md5_16( $string) : string
Parameters
$string :
Return values
string

moveTo()

public moveTo( $x,  $y) : mixed
Parameters
$x :
$y :
Return values
mixed

newPage()

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

public newPage(int $insert, int $id[, string $pos = 'after' ]) : int
Parameters
$insert : int
$id : int
$pos : string = 'after'
Return values
int

openHere()

specify where the document should open when it first starts

public openHere( $style, int $a, int $b, int $c) : mixed
Parameters
$style :
$a : int
$b : int
$c : int
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() : int

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

Return values
int

output()

return the pdf stream as a string returned from the function

public output([bool $debug = false ]) : string
Parameters
$debug : bool = false
Return values
string

partEllipse()

draw a part of an ellipse

public partEllipse( $x0,  $y0,  $astart,  $afinish,  $r1, int $r2, int $angle[, int $nSeg = 8 ]) : mixed
Parameters
$x0 :
$y0 :
$astart :
$afinish :
$r1 :
$r2 : int
$angle : int
$nSeg : int = 8
Return values
mixed

polygon()

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

public polygon( $p,  $np[, bool $f = false ]) : mixed
Parameters
$p :
$np :
$f : bool = 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()

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

public rect( $x1,  $y1,  $width,  $height) : mixed
Parameters
$x1 :
$y1 :
$width :
$height :
Return values
mixed

rectangle()

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

public rectangle( $x1,  $y1,  $width,  $height) : mixed
Parameters
$x1 :
$y1 :
$width :
$height :
Return values
mixed

registerText()

register text for font subsetting

public registerText( $font,  $text) : mixed
Parameters
$font :
$text :
Return values
mixed

reopenObject()

open an existing object for editing

public reopenObject( $id) : mixed
Parameters
$id :
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( $obj) : int
Parameters
$obj :
Return values
int

restoreState()

restore a previously saved state

public restoreState(int $pageEnd) : mixed
Parameters
$pageEnd : int
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 abscissa

$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(int $pageEnd) : mixed
Parameters
$pageEnd : int
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 abscissa

$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( $fontName[, string $encoding = '' ][, bool $set = true ][, bool $isSubsetting = true ]) : int
Parameters
$fontName :
$encoding : string = ''
$set : bool = true
$isSubsetting : bool = true
Tags
throws
FontNotFoundException
Return values
int

serializeObject()

return a storable representation of a specific object

public serializeObject( $id) : string|null
Parameters
$id :
Return values
string|null

setColor()

sets the color for fill operations

public setColor( $color[, bool $force = false ]) : mixed
Parameters
$color :
$force : bool = 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([string $userPass = '' ][, string $ownerPass = '' ][, array<string|int, mixed> $pc = [] ]) : mixed

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

Parameters
$userPass : string = ''
$ownerPass : string = ''
$pc : array<string|int, mixed> = []
Return values
mixed

setFillRule()

sets the color for fill operations

public setFillRule( $fillRule) : mixed
Parameters
$fillRule :
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( $family[, string $options = '' ]) : mixed
Parameters
$family :
$options : string = ''
Return values
mixed

setFormFieldAppearance()

set Field Appearanc (reference)

public setFormFieldAppearance(int $numFieldObj, int $normalNumObj[, int|null $rolloverNumObj = null ][, int|null $downNumObj = null ]) : mixed
Parameters
$numFieldObj : int
$normalNumObj : int
$rolloverNumObj : int|null = null
$downNumObj : int|null = null
Return values
mixed

setFormFieldOpt()

set Choice Field option values

public setFormFieldOpt(int $numFieldObj, array<string|int, mixed> $value) : mixed
Parameters
$numFieldObj : int
$value : array<string|int, mixed>
Return values
mixed

setFormFieldRefValue()

set Field value (reference)

public setFormFieldRefValue(int $numFieldObj, int $numObj) : mixed
Parameters
$numFieldObj : int
$numObj : int

Object number

Return values
mixed

setFormFieldValue()

set Field value

public setFormFieldValue(int $numFieldObj, string $value) : mixed
Parameters
$numFieldObj : int
$value : string
Return values
mixed

setGraphicsState()

Set the graphics state for compositions

public setGraphicsState( $parameters) : mixed
Parameters
$parameters :
Return values
mixed

setLineStyle()

this sets the line drawing style.

public setLineStyle([int $width = 1 ][, string $cap = '' ][, string $join = '' ][, string $dash = '' ], int $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 : int = 1
$cap : string = ''
$join : string = ''
$dash : string = ''
$phase : int
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( $label, int $value) : mixed
Parameters
$label :
$value : int
Return values
mixed

setStrokeColor()

sets the color for stroke operations

public setStrokeColor( $color[, bool $force = false ]) : mixed
Parameters
$color :
$force : bool = false
Return values
mixed

setXObjectResource()

public setXObjectResource(int $numXObject, string $type, array<string|int, mixed> $options) : mixed
Parameters
$numXObject : int
$type : string
$options : array<string|int, mixed>
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 abscissa

$y : float

Origin ordinate

Return values
mixed

stopObject()

stop an object from appearing on pages from this point on

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

stream()

Streams the PDF to the client.

public stream([string $filename = "document.pdf" ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$filename : string = "document.pdf"

The filename to present to the client.

$options : array<string|int, mixed> = []

Associative array: 'compress' => 1 or 0 (default 1); 'Attachment' => 1 or 0 (default 1).

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( $action) : mixed
Parameters
$action :
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

utf8toCodePointsArray()

return array containing codepoints (UTF-8 character values) for the string passed in.

public utf8toCodePointsArray(string &$text) : array<string|int, mixed>

based on the excellent TCPDF code by Nicola Asuni and the RFC for UTF-8 at http://www.faqs.org/rfcs/rfc3629.html

Parameters
$text : string

UTF-8 string to process

Tags
access

private

author

Orion Richardson

since

January 5, 2008

Return values
array<string|int, mixed>

UTF-8 codepoints array for the string

utf8toUtf16BE()

convert UTF-8 to UTF-16 with an additional byte order marker at the front if required.

public utf8toUtf16BE(string &$text[, bool $bom = true ]) : string

based on the excellent TCPDF code by Nicola Asuni and the RFC for UTF-8 at http://www.faqs.org/rfcs/rfc3629.html

Parameters
$text : string

UTF-8 string to process

$bom : bool = true

whether to add the byte order marker

Tags
access

private

author

Orion Richardson

since

January 5, 2008

Return values
string

UTF-16 result string

addImagePngAlpha()

protected addImagePngAlpha( $file,  $x,  $y,  $w,  $h,  $byte) : mixed
Parameters
$file :
$x :
$y :
$w :
$h :
$byte :
Return values
mixed

getFontSubsettingTag()

protected getFontSubsettingTag(array<string|int, mixed> $font) : string
Parameters
$font : array<string|int, mixed>
Return values
string

o_acroform()

protected o_acroform( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_action()

an action object, used to link to URLS initially

protected o_action( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_annotation()

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

protected o_annotation( $id,  $action[, string $options = '' ]) : null|string

initially will support just link annotations

Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_catalog()

define the document catalog, the overall controller for the document

protected o_catalog( $id,  $action[, string|array<string|int, mixed> $options = '' ]) : string|null
Parameters
$id :
$action :
$options : string|array<string|int, mixed> = ''
Return values
string|null

o_cidSystemInfo()

CID system info section, needed for unicode fonts

protected o_cidSystemInfo( $id,  $action) : null|string
Parameters
$id :
$action :
Return values
null|string

o_contents()

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

protected o_contents( $id,  $action[, string|array<string|int, mixed> $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string|array<string|int, mixed> = ''
Return values
null|string

o_destination()

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

protected o_destination( $id,  $action[, string $options = '' ]) : string|null
Parameters
$id :
$action :
$options : string = ''
Return values
string|null

o_embedded_file()

protected o_embedded_file(mixed $id, mixed $action[, mixed $options = null ]) : string|null
Parameters
$id : mixed
$action : mixed
$options : mixed = null
Return values
string|null

o_embedded_file_dictionary()

protected o_embedded_file_dictionary(mixed $id, mixed $action[, mixed $options = null ]) : mixed
Parameters
$id : mixed
$action : mixed
$options : mixed = null
Return values
mixed

o_embedjs()

protected o_embedjs( $id,  $action) : string|null
Parameters
$id :
$action :
Return values
string|null

o_encryption()

encryption object.

protected o_encryption( $id,  $action[, string $options = '' ]) : string|null
Parameters
$id :
$action :
$options : string = ''
Return values
string|null

o_extGState()

graphics state object

protected o_extGState( $id,  $action[, string $options = "" ]) : null|string
Parameters
$id :
$action :
$options : string = ""
Return values
null|string

o_field()

protected o_field( $id,  $action[, mixed $options = '' ]) : null|string
Parameters
$id :
$action :
$options : mixed = ''
Return values
null|string

o_font()

an object to hold the font description

protected o_font( $id,  $action[, string|array<string|int, mixed> $options = '' ]) : string|null
Parameters
$id :
$action :
$options : string|array<string|int, mixed> = ''
Tags
throws
FontNotFoundException
Return values
string|null

o_fontDescendentCID()

a descendent cid font, needed for unicode fonts

protected o_fontDescendentCID( $id,  $action[, string|array<string|int, mixed> $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string|array<string|int, mixed> = ''
Return values
null|string

o_fontDescriptor()

a font descriptor, needed for including additional fonts

protected o_fontDescriptor( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_fontEncoding()

the font encoding

protected o_fontEncoding( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_fontGIDtoCIDMap()

a font glyph to character map, needed for unicode fonts

protected o_fontGIDtoCIDMap( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_image()

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

protected o_image( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_indirect_references()

protected o_indirect_references(mixed $id, mixed $action[, mixed $options = null ]) : mixed
Parameters
$id : mixed
$action : mixed
$options : mixed = null
Return values
mixed

o_info()

define the document information

protected o_info( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_javascript()

protected o_javascript( $id,  $action[, string $code = '' ]) : null|string
Parameters
$id :
$action :
$code : string = ''
Return values
null|string

o_names()

protected o_names(mixed $id, mixed $action[, mixed $options = null ]) : mixed
Parameters
$id : mixed
$action : mixed
$options : mixed = null
Return values
mixed

o_outlines()

define the outlines in the doc, empty for now

protected o_outlines( $id,  $action[, string $options = '' ]) : string|null
Parameters
$id :
$action :
$options : string = ''
Return values
string|null

o_page()

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

protected o_page( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_pages()

object which is a parent to the pages in the document

protected o_pages( $id,  $action[, string $options = '' ]) : string|null
Parameters
$id :
$action :
$options : string = ''
Return values
string|null

o_procset()

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

protected o_procset( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_sig()

protected o_sig( $id,  $action[, string $options = '' ]) : null|string
Parameters
$id :
$action :
$options : string = ''
Return values
null|string

o_toUnicode()

A toUnicode section, needed for unicode fonts

protected o_toUnicode( $id,  $action) : null|string
Parameters
$id :
$action :
Return values
null|string

o_viewerPreferences()

set the viewer preferences

protected o_viewerPreferences( $id,  $action[, string|array<string|int, mixed> $options = '' ]) : string|null
Parameters
$id :
$action :
$options : string|array<string|int, mixed> = ''
Return values
string|null

o_xobject()

protected o_xobject(int $id, string $action[, mixed $options = '' ]) : string
Parameters
$id : int
$action : string
$options : mixed = ''
Return values
string

addContent()

add content to the currently active object

private addContent( $content) : mixed
Parameters
$content :
Return values
mixed

addJpegImage_common()

common code used by the two JPEG adding functions

private addJpegImage_common( &$data,  $x,  $y, int $w, int $h,  $imageWidth,  $imageHeight[, int $channels = 3 ],  $imgname) : mixed
Parameters
$data :
$x :
$y :
$w : int
$h : int
$imageWidth :
$imageHeight :
$channels : int = 3
$imgname :
Return values
mixed

getBytes()

extract an integer from a position in a byte stream

private getBytes( &$data,  $pos,  $num) : int
Parameters
$data :
$pos :
$num :
Return values
int

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( $x,  $y,  $angle,  $size,  $wa,  $text) : array<string|int, mixed>
Parameters
$x :
$y :
$angle :
$size :
$wa :
$text :
Return values
array<string|int, mixed>

newDocument()

initialize 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([array<string|int, mixed> $pageSize = [0, 0, 612, 792] ]) : mixed
Parameters
$pageSize : array<string|int, mixed> = [0, 0, 612, 792]
Return values
mixed

openFont()

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

private openFont( $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 :
Return values
mixed

processFont()

private processFont(int $fontObjId, array<string|int, mixed> $object_info) : array<string|int, mixed>|false
Parameters
$fontObjId : int
$object_info : array<string|int, mixed>
Tags
throws
FontNotFoundException
Return values
array<string|int, mixed>|false

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 appropriate 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.

Return values
mixed

Search results