SetaPDF_Stamper The main class of the SetaPDF-Stamper Component
File: /SetaPDF v2/Stamper.php
Class hierarchy
Summary
Constants
PAGES_ALL
Page constant
PAGES_EVEN
Page constant
PAGES_FIRST
Page constant
PAGES_LAST
Page constant
PAGES_ODD
Page constant
POSITION_CENTER_BOTTOM
Position constant
POSITION_CENTER_MIDDLE
Position constant
POSITION_CENTER_TOP
Position constant
POSITION_LEFT_BOTTOM
Position constant
POSITION_LEFT_MIDDLE
Position constant
POSITION_LEFT_TOP
Position constant
POSITION_RIGHT_BOTTOM
Position constant
POSITION_RIGHT_MIDDLE
Position constant
POSITION_RIGHT_TOP
Position constant
VERSION
Version
Properties
$_currentStampData
The currently handled stamp data.
$_document
Document which shall be stamped.
Static Methods
checkPositionParameter()
Checks whether the position parameter is valid.
This method allows you to check a string value against all predefined position
constants: SetaPDF_Stamper::POSITION_XXX
.
Parameters
- $position : string
The string value to check for validity
- $throwException : boolean
If this is set to true an exception will be thrown if the $position parameter is invalid. Otherwise, the method will return false.
Return Values
It will return true on success otherwise it will throw an InvalidArgumentException exception.
Exceptions
Throws InvalidArgumentException
checkShowOnPageParameter()
Checks whether the $showOnPage parameter is valid.
Parameters
- $showOnPage : int|string|array|callback
The value to check
- $throwException : boolean
If this is set to true an exception will be thrown if the $showOnPage parameter is invalid. Otherwise, the method will return false.
Exceptions
Throws InvalidArgumentException
Methods
__construct()
addStamp()
Adds a stamp object to the stamper instance.
Parameters
- $stamp : SetaPDF_Stamper_Stamp
Stamp object which shall be stamped on the document
- $positionOrConfig : string|array
Position or array of configuration variables
- $showOnPage : int|string|array|callback
The configuration defining on which pages the stamp shall be shown. Possible values are:
- PAGES_XXX constant
- Integer with the valid page number
- String with the valid page number or the valid range (e.g. '10-12')
- Array with all valid page numbers
- Callback with the arguments (int $pageNumber, int $pageCount)
- $translateX : int
Move the stamp on x-axis by $translateX
- $translateY : int
Move the stamp on y-axis by $translateX
- $rotation : float
Rotate the stamp by $rotation degrees
- $underlay : bool
Defines whether the stamp should be place before or after the existing content
- $callback : null|callback
Callback which will be called every time before the document will be stamped by this stamp if it's not returning true the stamp will not stamped on this run.
cleanUp()
Release objects to free memory and cycled references.
After calling this method the instance of this object is unusable.
stampPageNo()
This method will only stamp the page $pageNumber with all added stamps.
Parameters
- $pageNumber : integer
The number of the page which will be stamped
Exceptions
Throws InvalidArgumentException