Text Stamp
Table of Contents
Introduction
The text stamp class lets you stamp simple text onto existing PDF pages. Internally it encapsulates a text block instance which can be styled in various ways.
Font Handling
A font is represented as an object instance. The Core component comes with all available 14 standard fonts and lets you create own fonts based on TrueType font files.
Create an Instance
An instance of a text stamp could be created by simply passing a font object to its constructor:
$font = \SetaPDF_Core_Font_Standard_Helvetica::create($document); $stamp = new \SetaPDF_Stamper_Stamp_Text($font);
Configure Properties
Beside the general stamp properties the text stamp class offers following properties to configured the text appearance in various ways:
Text
Text related properties could be controlled by following methods:
getCharSpacing()
Get the character spacing value.
getFont()
Get the current font object.
getFontSize()
Get the font size.
getLineHeight()
Get the line height / leading.
getText()
Get the text.
getWordSpacing()
Get the word spacing value.
setCharSpacing()
Set the character spacing value.
setFont()
Set the font object and size.
setFontSize()
Set the font size.
setLineHeight()
Set the line height / leading.
setText()
Set the text.
setWordSpacing()
Set the word spacing value.
Layout
To layout a text stamp following methods are available:
getAlign()
Get the text alignment.
getHeight()
Get the height of this stamp.
getOutlineColor()
Get the texts outline color object.
getOutlineWidth()
Get the outline width.
getPaddingBottom()
Get the bottom padding.
getPaddingLeft()
Get the left padding.
getPaddingRight()
Get the right padding.
getPaddingTop()
Get the top padding.
getRenderingMode()
Get the defined rendering mode.
getTextColor()
Get the text color object.
setAlign()
Set the text alignment.
setOutlineColor()
Set the texts outline color.
setOutlineWidth()
Set the outline width.
setPadding()
Set the padding.
setPaddingBottom()
Set the bottom padding.
setPaddingLeft()
Set the left padding.
setPaddingRight()
Set the right padding.
setPaddingTop()
Set the top padding.
setRenderingMode()
Set the rendering mode.
setTextColor()
Set the text color.
setTextWidth()
Set the width of the text of the stamp.
Border and Background
getBackgroundColor()
Get the background color object.
getBorderColor()
Get the border color object.
getBorderWidth()
Get the border width.
setBackgroundColor()
Set the background color.
setBorderColor()
Set the border color.
setBorderWidth()
Set the border width.
Examples
Following some examples showing you some ideas of how to style a text stamp: