Svg\Surface\CPdf
Synopsis
class CPdf
{
- // members
- public integer $numObj = 0;
- public array $objects = ;
- public $catalogId;
- public array $fonts = ;
- public string $defaultFont = './fonts/Helvetica.afm';
- public string $currentFont = '';
- public string $currentBaseFont = '';
- public integer $currentFontNum = 0;
- public $currentNode;
- public $currentPage;
- public $currentContents;
- public integer $numFonts = 0;
- private integer $numStates = 0;
- public $currentColor = NULL;
- public string $fillRule = "nonzero";
- public $currentStrokeColor = NULL;
- public string $currentLineStyle = '';
- public array $currentLineTransparency = ;
- public array $currentFillTransparency = ;
- public array $stateStack = ;
- public integer $nStateStack = 0;
- public integer $numPages = 0;
- public array $stack = ;
- public integer $nStack = 0;
- public array $looseObjects = ;
- public array $addLooseObjects = ;
- public integer $infoObject = 0;
- public integer $numImages = 0;
- public array $options = ;
- public $firstPageId;
- public integer $wordSpaceAdjust = 0;
- public integer $charSpaceAdjust = 0;
- public $procsetObjectId;
- public array $fontFamilies = ;
- public string $fontcache = '';
- public integer $fontcacheVersion = 6;
- public string $tmp = '';
- public string $currentTextState = '';
- public string $messages = '';
- public string $arc4 = '';
- public integer $arc4_objnum = 0;
- public string $fileIdentifier = '';
- public boolean $encrypted = false;
- public string $encryptionKey = '';
- public array $callback = ;
- public integer $nCallback = 0;
- public array $destinations = ;
- public string $checkpoint = '';
- public array $imagelist = ;
- public boolean $isUnicode = false;
- public string $javascript = '';
- protected boolean $compressionReady = false;
- protected array $currentPageSize = ;
- protected array $stringSubsets = ;
- protected static string $targetEncoding = 'iso-8859-1';
- protected static array $coreFonts = ;
- // methods
- public void __construct()
- protected void o_destination()
- protected void o_viewerPreferences()
- protected void o_catalog()
- protected void o_pages()
- protected void o_outlines()
- protected void o_font()
- protected void o_fontDescriptor()
- protected void o_fontEncoding()
- protected void o_fontDescendentCID()
- protected void o_fontGIDtoCIDMap()
- protected void o_procset()
- protected void o_info()
- protected void o_action()
- protected void o_annotation()
- protected void o_page()
- protected void o_contents()
- protected void o_embedjs()
- protected void o_javascript()
- protected void o_image()
- protected void o_extGState()
- protected void o_encryption()
- public void md5_16()
- public void encryptInit()
- public void ARC4_init()
- public void ARC4()
- public void addLink()
- public void addInternalLink()
- public void setEncryption()
- public void checkAllHere()
- public void output()
- private void newDocument()
- private void openFont()
- public void selectFont()
- private void setCurrentFont()
- public void getFirstPageId()
- private void addContent()
- public void setColor()
- public void setFillRule()
- public void setStrokeColor()
- public void setGraphicsState()
- public void setLineTransparency()
- public void setFillTransparency()
- public void lineTo()
- public void moveTo()
- public void curveTo()
- public void quadTo()
- public void closePath()
- public void endPath()
- public void ellipse()
- public void setLineStyle()
- public void rect()
- public void stroke()
- public void fill()
- public void fillStroke()
- public void save()
- public void restore()
- public void scale()
- public void translate()
- public void rotate()
- public void skew()
- public void transform()
- public void newPage()
- public void stream()
- public void getFontHeight()
- public void getFontXHeight()
- public void getFontDescender()
- public void filterText()
- private void getTextPosition()
- public string toUpper()
- public void concatMatches()
- public void registerText()
- public void addText()
- public void getTextWidth()
- public void saveState()
- public void restoreState()
- public void openObject()
- public void reopenObject()
- public void closeObject()
- public void stopObject()
- public void addObject()
- public void serializeObject()
- public void restoreSerializedObject()
- public void addInfo()
- public void setPreferences()
- private void getBytes()
- public void image_iscached()
- public void addImagePng()
- protected void addImagePngAlpha()
- public void addPngFromFile()
- public void addPngFromBuf()
- public void addJpegFromFile()
- private void addJpegImage_common()
- public void openHere()
- public void addJavascript()
- public void addDestination()
- public void setFontFamily()
- public void addMessage()
- public void transaction()
Members
private
- $numStates — integer
protected
- $compressionReady — boolean
- $coreFonts — array
- $currentPageSize — array
- $stringSubsets — array
- $targetEncoding — string
public
-
$addLooseObjects
array contains infomation about how the loose objects are to be added to the document - $arc4 — string
- $arc4_objnum — integer
- $callback — array
- $catalogId — integer
- $charSpaceAdjust — float
- $checkpoint — array
- $currentBaseFont — string
- $currentColor — array
- $currentContents — integer
-
$currentFillTransparency
array Current fill transparency (partial graphics state) - $currentFont
- $currentFontNum — integer
- $currentLineStyle — string
- $currentLineTransparency — array
- $currentNode — integer
- $currentPage — integer
- $currentStrokeColor — array
- $currentTextState — string
- $defaultFont — string
- $destinations — array
- $encrypted — boolean
- $encryptionKey — string
- $fileIdentifier — string
- $fillRule — string
- $firstPageId — integer
- $fontFamilies — array
- $fontcache — string
- $fontcacheVersion — integer
- $fonts — array
- $imagelist — array
- $infoObject — integer
- $isUnicode — boolean
- $javascript — string
-
$looseObjects
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 — integer
- $nStack — integer
- $nStateStack — integer
- $numFonts — integer
- $numImages — integer
- $numObj — integer
- $numPages — integer
- $objects — array
- $options — array
- $procsetObjectId — integer
- $stack — array
- $stateStack — array
- $tmp — string
- $wordSpaceAdjust — float
Methods
private
- addContent() — add content to the currently active object
- addJpegImage_common() — common code used by the two JPEG adding functions
- getBytes() — extract an integer from a position in a byte stream
- getTextPosition() — given a start position and information about how text is to be laid out, calculate where on the page the text will end
- 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
- openFont() — open the font file and return a php structure containing it.
- 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.
protected
- addImagePngAlpha()
- o_action() — an action object, used to link to URLS initially
- o_annotation() — an annotation object, this will add an annotation to the current page.
- o_catalog() — define the document catalog, the overall controller for the document
- o_contents() — the contents objects hold all of the content which appears on pages
- o_destination() — Destination object, used to specify the location for the user to jump to, presently on opening
- o_embedjs()
- o_encryption() — encryption object.
- o_extGState() — graphics state object
- o_font() — an object to hold the font description
- o_fontDescendentCID() — a descendent cid font, needed for unicode fonts
- o_fontDescriptor() — a font descriptor, needed for including additional fonts
- o_fontEncoding() — the font encoding
- o_fontGIDtoCIDMap() — a font glyph to character map, needed for unicode fonts
- o_image() — an image object, will be an XObject in the document, includes description and data
- o_info() — define the document information
- o_javascript()
- o_outlines() — define the outlines in the doc, empty for now
- o_page() — a page object, it also creates a contents object to hold its contents
- o_pages() — object which is a parent to the pages in the document
- o_procset() — the document procset, solves some problems with printing to old PS printers
- o_viewerPreferences() — set the viewer preferences
public
- __construct() — Class constructor This will start a new document
- ARC4() — ARC4 encrypt a text string
- ARC4_init() — initialize the ARC4 encryption
- addDestination() — create a labelled destination within the document
- addImagePng() — add a PNG image into the document, from a GD object this should work with remote files
- addInfo() — add content to the documents info object
- addInternalLink() — add a link in the document to an internal destination (ie. within the document)
- addJavascript() — Add JavaScript code to the PDF document
- addJpegFromFile() — add a JPEG image into the document, from a file
- addLink() — add a link in the document to an external URL
- addMessage() — used to add messages for use in debugging
- addObject() — after an object has been created, it wil only show if it has been added, using this function.
- addPngFromBuf() — add a PNG image into the document, from a memory buffer of the file
- addPngFromFile() — add a PNG image into the document, from a file this should work with remote files
- addText() — add text to the document, at a specified location, size and angle on the page
- checkAllHere() — should be used for internal checks, not implemented as yet
- closeObject() — close an object
- closePath()
- concatMatches()
- curveTo() — draw a bezier curve based on 4 control points
- ellipse() — draw an ellipse note that the part and filled ellipse are just special cases of this function
- encryptInit() — initialize the encryption for processing a particular object
- endPath()
- fill()
- fillStroke()
- 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
- 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.
- 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
- getFontHeight() — return the height in units of the current font in the given size
- getFontXHeight()
- getTextWidth() — calculate how wide a given text string will be on a page, at a given size.
- image_iscached() — Check if image already added to pdf image directory.
- lineTo()
- md5_16() — calculate the 16 byte version of the 128 bit md5 digest of the string
- moveTo()
- newPage() — add a new page to the document this also makes the new page the current active object
- openHere() — specify where the document should open when it first starts
- openObject() — make a loose object, the output will go into this object, until it is closed, then will revert to the current one.
- output() — return the pdf stream as a string returned from the function
- quadTo() — draw a bezier curve based on 4 control points
- rect()
- registerText() — add text to the document, at a specified location, size and angle on the page
- reopenObject() — open an existing object for editing
- restore() — restore the last graphic state
- restoreSerializedObject() — restore an object from its stored representation. returns its new object id.
- restoreState() — restore a previously saved state
- rotate() — rotate
- save() — save the current graphic state
- 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
- scale() — scale
- 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.
- serializeObject() — return a storable representation of a specific object
- setColor() — sets the color for fill operations
- setEncryption() — set the encryption of the document can be used to turn it on and/or set the passwords which it will have.
- setFillRule() — sets the color for fill operations
- setFillTransparency() — Set current blend mode & opacity for filled objects.
- 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.
- setGraphicsState() — Set the graphics state for compositions
- setLineStyle() — this sets the line drawing style.
- setLineTransparency() — Set current blend mode & opacity for lines.
- setPreferences() — set the viewer preferences of the document, it is up to the browser to obey these.
- setStrokeColor() — sets the color for stroke operations
- skew() — skew
- stopObject() — stop an object from appearing on pages from this point on
- stream() — output the pdf code, streaming it to the browser the relevant headers are set so that hopefully the browser will recognise it
- stroke()
- toUpper() — Callback method used by smallCaps
- transaction() — a few functions which should allow the document to be treated transactionally.
- transform() — apply graphic transformations
- translate() — translate