$co = PDF::API2::Content->new @parameters

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

$co->add @content

Adds @content to the object.

$co->save

Saves the state of the object.

$co->restore

Restores the state of the object.

$co->compress

Marks content for compression on output.

$co->flatness $flat

Sets flatness.

$co->linecap $cap

Sets linecap.

$co->linedash @dash

Sets linedash.

$co->linejoin $join

Sets linejoin.

$co->linewidth $width

Sets linewidth.

$co->meterlimit $limit

Sets meterlimit.

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

Sets matrix transformation.

$co->translate $x,$y

Sets translation transformation.

$co->scale $sx,$sy

Sets scaleing transformation.

$co->skew $sa,$sb

Sets skew transformation.

$co->rotate $rot

Sets rotation transformation.

$co->transform %opts

Sets transformations (eg. translate, rotate, scale, skew) in pdf-canonical order.

Example:

$co->transform(
    -translate => [$x,$y],
    -rotate    => $rot,
    -scale     => [$sx,$sy],
    -skew      => [$sa,$sb],
)
$co->fillcolor @colors
$co->strokecolor @colors

Sets fill-/strokecolor, see PDF::API2::Util for a list of possible color specifiers.

Examples:

$co->fillcolor('blue');       # blue
$co->strokecolor('#FF0000');  # red
$co->fillcolor('%FFF000000'); # cyan

GRAPHICS METHODS

$gfx->move $x, $y
$gfx->line $x, $y
$gfx->hline $x
$gfx->vline $y
$gfx->curve $x1, $y1, $x2, $y2, $x3, $y3
$gfx->arc $x, $y, $a, $b, $alfa, $beta, $move

will draw an arc centered at x,y with minor/major-axis given by a,b from alfa to beta (degrees). move must be set to 1, unless you want to continue an existing path.

$gfx->ellipse $x, $y, $a, $b
$gfx->circle $x, $y, $r
$gfx->bogen $x1, $y1, $x2, $y2, $r, $move, $larc, $span

will draw an arc of a circle from x1,y1 to x2,y2 with radius r. move must be set to 1, unless you want to continue an existing path. larc can be set to 1, if you want to draw the larger instead of the shorter arc. span can be set to 1, if you want to draw the arc on the other side. NOTE: 2*r cannot be smaller than the distance from x1,y1 to x2,y2.

$gfx->pie $x, $y, $a, $b, $alfa, $beta
$gfx->rect $x1,$y1, $w1,$h1, ..., $xn,$yn, $wn,$hn
$gfx->rectxy $x1,$y1, $x2,$y2
$gfx->poly $x1,$y1, ..., $xn,$yn
$gfx->close
$gfx->endpath
$gfx->clip $nonzero
$gfx->stroke
$gfx->fill $nonzero
$gfx->fillstroke $nonzero
$gfx->image $imgobj, $x,$y, $w,$h
$gfx->image $imgobj, $x,$y, $scale
$gfx->image $imgobj, $x,$y

Please Note: The width/height or scale given is in user-space coordinates which is subject to transformations which may have been specified beforehand.

Per default this has a 72dpi resolution, so if you want an image to have a 150 or 300dpi resolution, you should specify a scale of 72/150 (or 72/300) or adjust width/height accordingly.

$gfx->formimage $imgobj, $x, $y, $scale
$gfx->formimage $imgobj, $x, $y

Please Note: *TODO*

$gfx->shade $shadeobj, $x1,$y1, $x2,$y2
$gfx->egstate $egsobj
$hyb->textstart
%state = $txt->textstate %state

Sets or gets the current text-object state.

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

Gets the current estimated text position.

$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.

$txt->text_center $text
$txt->text_right $text, %options
$hyb->textend
$width = $txt->textlabel $x, $y, $font, $size, $text, %options

Applys text with options, but without teststart/end and optionally returns the width of the given text.

Example:

$t = $page->gfx;
$t->textlabel(300,700,$myfont,20,'Page Header',
    -rotate => -30,
    -color => '#FF0000',
    -hspace => 120,
    -center => 1,
);

AUTHOR

alfred reibenschuh

HISTORY

$Log: Content.pm,v $
Revision 1.9  2004/04/07 10:49:26  fredo
fixed handling of colorSpaces for fill/strokecolor

Revision 1.8  2004/02/12 14:46:44  fredo
removed duplicate definition of egstate method

Revision 1.7  2004/02/06 02:01:25  fredo
added save/restore around textlabel

Revision 1.6  2004/02/05 23:24:00  fredo
fixed lab behavior

Revision 1.5  2004/02/05 12:26:08  fredo
revised '_makecolor' to use Lab for hsv/hsl,
added textlabel method

Revision 1.4  2003/12/08 13:05:19  Administrator
corrected to proper licencing statement

Revision 1.3  2003/11/30 17:09:18  Administrator
merged into default

Revision 1.2.2.1  2003/11/30 16:56:21  Administrator
merged into default

Revision 1.2  2003/11/30 11:33:59  Administrator
added CVS id/log

3 POD Errors

The following errors were encountered while parsing the POD:

Around line 92:

'=item' outside of any '=over'

Around line 548:

You forgot a '=back' before '=head1'

Around line 1660:

You forgot a '=back' before '=head1'