SetaPDF_Stamper The main class of the SetaPDF-Stamper Component

File: /SetaPDF v2/Stamper.php

Class hierarchy

Summary

Constants

PAGES_ALL

public const string SetaPDF_Stamper::PAGES_ALL = 'all'

Page constant

PAGES_EVEN

public const string SetaPDF_Stamper::PAGES_EVEN = 'even'

Page constant

PAGES_FIRST

public const string SetaPDF_Stamper::PAGES_FIRST = 'first'

Page constant

PAGES_LAST

public const string SetaPDF_Stamper::PAGES_LAST = 'last'

Page constant

PAGES_ODD

public const string SetaPDF_Stamper::PAGES_ODD = 'odd'

Page constant

POSITION_CENTER_BOTTOM

public const string SetaPDF_Stamper::POSITION_CENTER_BOTTOM = 'CB'

Position constant

POSITION_CENTER_MIDDLE

public const string SetaPDF_Stamper::POSITION_CENTER_MIDDLE = 'CM'

Position constant

POSITION_CENTER_TOP

public const string SetaPDF_Stamper::POSITION_CENTER_TOP = 'CT'

Position constant

POSITION_LEFT_BOTTOM

public const string SetaPDF_Stamper::POSITION_LEFT_BOTTOM = 'LB'

Position constant

POSITION_LEFT_MIDDLE

public const string SetaPDF_Stamper::POSITION_LEFT_MIDDLE = 'LM'

Position constant

POSITION_LEFT_TOP

public const string SetaPDF_Stamper::POSITION_LEFT_TOP = 'LT'

Position constant

POSITION_RIGHT_BOTTOM

public const string SetaPDF_Stamper::POSITION_RIGHT_BOTTOM = 'RB'

Position constant

POSITION_RIGHT_MIDDLE

public const string SetaPDF_Stamper::POSITION_RIGHT_MIDDLE = 'RM'

Position constant

POSITION_RIGHT_TOP

public const string SetaPDF_Stamper::POSITION_RIGHT_TOP = 'RT'

Position constant

VERSION

public const string SetaPDF_Stamper::VERSION = '2.45.0.1963'

Version


Properties

$_currentStampData

The currently handled stamp data.

$_document

Document which shall be stamped.

$_stampsData

protected array SetaPDF_Stamper::$_stampsData = array()

Array of all stamps.


Static Methods

checkPositionParameter()

public static SetaPDF_Stamper::checkPositionParameter (
string $position [, boolean $throwException = true ]
): bool

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()

public static SetaPDF_Stamper::checkShowOnPageParameter (
int|string|array|callback $showOnPage [, boolean $throwException = true ]
): bool

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()

The constructor.

Parameters
$document : SetaPDF_Core_Document

The document instance

addStamp()

public SetaPDF_Stamper::addStamp (
SetaPDF_Stamper_Stamp $stamp [, string|array $positionOrConfig = SetaPDF_Stamper::POSITION_LEFT_TOP [, int|string|array|callback $showOnPage = SetaPDF_Stamper::PAGES_ALL [, int $translateX = 0 [, int $translateY = 0 [, float $rotation = 0.0 [, bool $underlay = false [, null|callback $callback = null ]]]]]]]
): void

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()

public SetaPDF_Stamper::cleanUp (
void
): void

Release objects to free memory and cycled references.

After calling this method the instance of this object is unusable.

getDocument()

Get the document which shall be stamped.

stamp()

public SetaPDF_Stamper::stamp (
void
): void

This method will stamp the complete document with all added stamps.

See

stampPageNo()

public SetaPDF_Stamper::stampPageNo (
integer $pageNumber
): bool

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

See