PDF::API2::Text

Subclassed from PDF::API2::Content.

        $txt = PDF::API2::Text->new @parameters
                

Returns a new text content object (called from $page->text).

        %state = $txt->textstate %state
                

Sets or gets the current text-object state.

        ($tx,$ty) = $txt->textpos
                

Gets the current estimated text position.

        $txt->matrix $a, $b, $c, $d, $e, $f
                

Sets the matrix.

PLEASE NOTE: This method is not expected to be called by the user and else will 'die'. This was implemented to keep proper state in the text-object, so please use transform, transform_rel, translate, scale, skew or rotate instead.

        $txt->transform_rel %opts
                

Sets transformations (eg. translate, rotate, scale, skew) in pdf-canonical order, but relative to the previously set values.

Example:


  $txt->transform_rel(
    -translate => [$x,$y],
    -rotate    => $rot,
    -scale     => [$sx,$sy],
    -skew      => [$sa,$sb],
  )

        $txt->font $fontobj,$size
                         $spacing = $txt->charspace $spacing
                         $spacing = $txt->wordspace $spacing
                         $spacing = $txt->hspace $spacing
                         $leading = $txt->lead $leading
                         $rise = $txt->rise $rise
                         $rendering = $txt->render $rendering
                         $txt->cr $linesize
                

takes an optional argument giving a custom leading between lines.

        $txt->nl
                         $txt->distance $dx,$dy
                         $width = $txt->advancewidth $string
                

Returns the width of the string based on all currently set text-attributes.

        $width = $txt->text $text, %options
                

Applys text to the content and optionally returns the width of the given text.

You can use the -utf8 option to give the text in utf8.

        $txt->text_center $text, %options
                

You can use the -utf8 option to give the text in utf8.

        $txt->text_right $text, %options
                

You can use the -utf8 option to give the text in utf8.

        ($width, $overflow) = $txt->text_justify $text , -width => $width [, %options ]
                

If -overflow is given, $overflow will contain any text, which wont fit into width without exessive scaling.

If -underflow is given, and $text is smaller than $width the text will be typeset using $txt->text.

if -less is given, text overflow will be calculated using minimal number of words.

You can use the -utf8 option to give the text in utf8.

The returned width is that of the typeset text.

        ($w,$y,$text) = $txt->paragraph $text, %options,
-x => $xorg,
-y => $yorg,
-w => $width,
-h => $height,
-flindent => $firstlineindent,
-lead => $lead
                

You can use the -utf8 option to give the text in utf8.


  $w ... witdth of the text on the last line.
  $y ... y-coord of the last line.
  $text ... any left-over text which did not fit into the paragraph

AUTHOR

alfred reibenschuh