setasign\SetaPDF2\Core\Canvas

Text A canvas helper class for text operators

File: /SetaPDF v2/Core/Canvas/Text.php
Old class name (alias): \SetaPDF_Core_Canvas_Text

Class hierarchy

Summary

Constants

RENDERING_MODE_CLIP

public const int Text::RENDERING_MODE_CLIP = 7

Rendering mode

RENDERING_MODE_FILL

public const int Text::RENDERING_MODE_FILL = 0

Rendering mode

RENDERING_MODE_FILL_AND_CLIP

public const int Text::RENDERING_MODE_FILL_AND_CLIP = 4

Rendering mode

RENDERING_MODE_FILL_AND_STROKE

public const int Text::RENDERING_MODE_FILL_AND_STROKE = 2

Rendering mode

RENDERING_MODE_FILL_STROKE_AND_CLIP

Rendering mode

RENDERING_MODE_INVISIBLE

public const int Text::RENDERING_MODE_INVISIBLE = 3

Rendering mode

RENDERING_MODE_STROKE

public const int Text::RENDERING_MODE_STROKE = 1

Rendering mode

RENDERING_MODE_STROKE_AND_CLIP

public const int Text::RENDERING_MODE_STROKE_AND_CLIP = 5

Rendering mode


Properties

$_canvas

The origin canvas object


Methods

__construct()

The constructor.

Parameters
$canvas : \SetaPDF_Core_Canvas
 

addCurrentTransformationMatrix()

public StandardOperators::addCurrentTransformationMatrix (
float|int $a,
float|int $b,
float|int $c,
float|int $d,
float|int $e,
float|int $f
): $this

Proxy method for adding a transformation matrix on the canvas.

Parameters
$a : float|int
 
$b : float|int
 
$c : float|int
 
$d : float|int
 
$e : float|int
 
$f : float|int
 
See

begin()

Begin a text object.

beginText()

WARNING: This method is marked as deprecated!

Alias for begin()

See

cleanUp()

public Operators::cleanUp (
void
): void

Release objects to free memory and cycled references.

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

draw()

Get the draw helper.

end()

End a text object.

endText()

WARNING: This method is marked as deprecated!

Alias for end()

See

markedContent()

Get the marked content helper.

moveToNextLine()

public Text::moveToNextLine (
float $x,
float $y,
bool $setLeading = false
): \SetaPDF_Core_Canvas_Text

Move to the next line.

Parameters
$x : float
 
$y : float
 
$setLeading : bool
 

moveToNextLineAndShowText()

public Text::moveToNextLineAndShowText (
string|string[] $text,
float $wordSpacing = null,
float $charSpacing = null
): \SetaPDF_Core_Canvas_Text

Move to the next line and show text.

Parameters
$text : string|string[]
 
$wordSpacing : float
 
$charSpacing : float
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

moveToStartOfNextLine()

Move to the start of the next line.

path()

Get the path helper.

restoreGraphicState()

Proxy method for restoring the graphic state on the canvas.

See

rotate()

public StandardOperators::rotate (
int|float $x,
int|float $y,
int|float $angle
): $this

Proxy method for rotating the transformation matrix on the canvas.

Parameters
$x : int|float

X-coordinate of rotation point

$y : int|float

Y-coordinate of rotation point

$angle : int|float

Angle to rotate in degrees

See

saveGraphicState()

Proxy method for saving the graphic state on the canvas.

See

scale()

public StandardOperators::scale (
int|float $scaleX,
int|float $scaleY
): $this

Proxy method for scaling the transformation matrix on the canvas.

Parameters
$scaleX : int|float

Scale factor on X

$scaleY : int|float

Scale factor on Y

See

setCharSpacing()

WARNING: This method is marked as deprecated!

public Text::setCharSpacing (
float $charSpacing = 0.0
): \SetaPDF_Core_Canvas_Text

Alias for setCharacterSpacing()

Parameters
$charSpacing : float
 
See

setCharacterSpacing()

public Text::setCharacterSpacing (
float $charSpacing = 0.0
): \SetaPDF_Core_Canvas_Text

Set the char spacing.

Parameters
$charSpacing : float
 

setColor()

public StandardOperators::setColor (
\SetaPDF_Core_DataStructure_Color|int[]|int|string $color,
bool $stroking = true
): $this

Proxy method for setting the color on the canvas.

Parameters
$color : \SetaPDF_Core_DataStructure_Color|int[]|int|string
 
$stroking : bool
 
See

setGraphicState()

Proxy method for setting a graphic state on the canvas.

Parameters
$graphicState : \SetaPDF_Core_Resource_ExtGState
 
See

setLeading()

public Text::setLeading (
float $leading = 0.0
): \SetaPDF_Core_Canvas_Text

Set the leading.

Parameters
$leading : float
 

setNonStrokingColor()

Proxy method for setting the non-stroking color on the canvas.

Parameters
$color : \SetaPDF_Core_DataStructure_Color|int[]|int|string
 
See

setRenderingMode()

public Text::setRenderingMode (
int $renderingMode = 0
): \SetaPDF_Core_Canvas_Text

Set the rendering mode.

The available rendering modes are also available through class constants such as Text::RENDERING_MODE_CLIP.

Parameters
$renderingMode : int
 
See
  • PDF reference 32000-1:2008 9.3.6 Text Rendering Mode

setRise()

public Text::setRise (
float $rise = 0.0
): \SetaPDF_Core_Canvas_Text

Set text rise.

Parameters
$rise : float
 

setScaling()

public Text::setScaling (
float $scaling = 100.0
): \SetaPDF_Core_Canvas_Text

Set the horizontal scaling.

Parameters
$scaling : float
 

setStrokingColor()

Proxy method for setting the stroking color on the canvas.

Parameters
$color : \SetaPDF_Core_DataStructure_Color|int[]|int|string
 
See

setTextMatrix()

public Text::setTextMatrix (
float $a,
float $b,
float $c,
float $d,
float $e,
float $f
): \SetaPDF_Core_Canvas_Text

Set the text matrix.

Parameters
$a : float
 
$b : float
 
$c : float
 
$d : float
 
$e : float
 
$f : float
 

setTextRise()

WARNING: This method is marked as deprecated!

public Text::setTextRise (
float $textRise = 0.0
): \SetaPDF_Core_Canvas_Text

Alias for setRise()

Parameters
$textRise : float
 
See

setWordSpacing()

public Text::setWordSpacing (
float $wordSpacing = 0.0
): \SetaPDF_Core_Canvas_Text

Set the word spacing.

You shall notice that this word spacing property affects the character which is assigned to "\x20" of a font which uses a single byte encoding. When e.g. using subset fonts this setting will end in unwanted results.

Parameters
$wordSpacing : float
 

showText()

public Text::showText (
string|string[] $text
): \SetaPDF_Core_Canvas_Text

Show text.

Parameters
$text : string|string[]
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

showTextStrings()

public Text::showTextStrings (
array|string $textStrings
): \SetaPDF_Core_Canvas_Text

Shows text strings.

Parameters
$textStrings : array|string
 
Exceptions

Throws \setasign\SetaPDF2\Core\Exception

skew()

public StandardOperators::skew (
int|float $angleX,
int|float $angleY,
int|float $x = 0,
int|float $y = 0
): $this

Proxy method for skewing the transformation matrix on the canvas.

Parameters
$angleX : int|float

Angle to x-axis in degrees

$angleY : int|float

Angle to y-axis in degrees

$x : int|float

Points to stretch on x-axis

$y : int|float

Point to stretch on y-axis

See

text()

Get the text helper.

translate()

public StandardOperators::translate (
int|float $shiftX,
int|float $shiftY
): $this

Proxy method for moving the transformation matrix on the canvas.

Parameters
$shiftX : int|float

Points to move on x-axis

$shiftY : int|float

Points to move on y-axis

See