man PDF::API2::Content () - Content object for PDF::API2
NAME
PDF::API2::Content - Content object for PDF::API2
SYNOPSIS
$co = PDF::API2::Content->new CW@parameters
Returns a new content object (called from CW$page->text/gfx). Adds CW@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. Sets flatness. Sets linecap. Sets linedash. Sets linejoin. Sets linewidth. Sets meterlimit. Sets matrix transformation. Sets translation transformation. Sets scaleing transformation. Sets skew transformation. Sets rotation transformation. 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], )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
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. 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->close
- $gfx->endpath
- $gfx->stroke
- 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. Places the X-Object (or XO-Form) at x/y with optional scale.
- $hyb->textstart
-
Sets or gets the current text-object state.
Gets the current estimated text position.
Note: This is relative to text-space.
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], )
The fontset method WILL NOT APPLY the font+size to the pdf-stream, but which will later be done by the text-methods. Only use fontset if you know what you are doing, there is no super-secret failsave! takes an optional argument giving a custom leading between lines. - $txt->nl
- Returns the width of the string based on all currently set text-attributes or on those overridden by CW%textstate. Applys text to the content and optionally returns the width of the given text. Options
- -indent
- Indent the text by the number of points.
- -underline
-
If this is a scalar, it is the distance, in points, below the baseline where
the line is drawn. The line thickness is one point. If it is a reference to an
array, each pair is the distance below the baseline and the thickness of the
line (ie., CW-underline=>[2,1,4,2] will draw a double underline
with the lower twice as thick as the upper).
If thickness is a reference to an array, the first value is the thickness
and the second value is the color of the line (ie.,
CW-underline=>[2,[1,'red'],4,[2,'#0000ff']] will draw a red and a
blue line).
You can also use the string CW'auto' for either or both distance and thickness
values to auto-magically calculate best values from the font-definition.
** DEVELOPER METHOD **
** DEVELOPER METHOD **
** DEVELOPER METHOD **
** DEVELOPER METHOD **
** DEVELOPER METHOD **
** DEVELOPER METHOD **
Apply the text within the rectangle and return any leftover text.
Options
Choice is 'justified', 'right', 'center', 'left'
Default is 'left'
If a scalar, distance below baseline,
else array reference with pairs of distance and line thickness.
Example:
$txt->font($font,$fontsize); $txt->lead($lead); $txt->translate($x,$y); $overflow = $txt->paragraph( 'long paragraph here ...', $width, $y+$lead-$bottom_margin );
- $hyb->textend
-
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, -align => 'center', ); $t->textlabel(500,500,$myfont,20,'Page Header', -rotate => 30, -color => '#0000FF', -hspace => 80, -align => 'right', );
AUTHOR
alfred reibenschuh
HISTORY
$Log: Content.pm,v $ Revision 2.0 2005/11/16 02:16:00 areibens revision workaround for SF cvs import not to screw up CPAN
Revision 1.2 2005/11/16 01:27:48 areibens genesis2
Revision 1.1 2005/11/16 01:19:24 areibens genesis
Revision 1.40 2005/10/19 19:04:43 fredo added extended typographic text handling call
Revision 1.39 2005/10/01 22:10:57 fredo added more docs for textlabel
Revision 1.38 2005/06/17 19:43:46 fredo fixed CPAN modulefile versioning (again)
Revision 1.37 2005/06/17 18:53:04 fredo fixed CPAN modulefile versioning (dislikes cvs)
Revision 1.36 2005/05/29 09:48:46 fredo added conditional textstate2 method
Revision 1.35 2003/04/09 11:12:13 fredo documented form-image
Revision 1.34 2005/03/15 02:20:46 fredo added metadata stubs
Revision 1.33 2005/03/14 22:01:05 fredo upd 2005
Revision 1.32 2005/03/14 20:26:44 fredo added 'auto' value for -underline parameter in text fixed text line construction to to work under width==0 conditions
Revision 1.31 2005/02/22 22:59:49 fredo fixed infinite loop in paragraph if words longer than a paragraph are present.
Revision 1.30 2005/02/07 19:31:24 fredo fixed reset of textlinematrix on textmatrix set/resets
Revision 1.29 2005/01/21 10:19:48 fredo added spline operator
Revision 1.28 2005/01/03 01:16:51 fredo fixed textpos tracking in nl method
Revision 1.27 2004/12/31 03:59:09 fredo fixed paragraph and text_fill_* methods (thanks to Shawn Corey <shawn.corey@sympatico.ca>)
Revision 1.26 2004/12/31 02:53:18 fredo minor code corrections
Revision 1.25 2004/12/31 02:06:37 fredo fixed textpos calculation, added underline capability (thanks to Shawn Corey <shawn.corey@sympatico.ca>)
Revision 1.24 2004/12/29 22:01:57 fredo advancewidth now can take a virtual textstate
Revision 1.23 2004/12/29 01:48:15 fredo fixed _font method
Revision 1.22 2004/12/29 01:14:57 fredo added virtual attribute support
Revision 1.21 2004/12/20 12:11:54 fredo added fontset method to not set via 'Tf'
Revision 1.20 2004/12/16 00:30:51 fredo added no warn for recursion
Revision 1.19 2004/12/15 16:44:43 fredo added condition to apply font (Tf) only when needed
Revision 1.18 2004/11/25 20:53:59 fredo fixed unifont registration
Revision 1.17 2004/11/24 20:10:31 fredo added virtual font handling, fixed var shadow bug
Revision 1.16 2004/10/26 11:34:22 fredo reworked text_fill for paragraph, but still being development
Revision 1.15 2004/08/31 13:50:09 fredo fixed space vs. whitespace split bug
Revision 1.14 2004/07/29 10:46:37 fredo added new text_fill_* methods and a simple paragraph
Revision 1.13 2004/06/21 22:33:36 fredo added basic pattern/shading handling
Revision 1.12 2004/06/15 09:11:37 fredo removed cr+lf
Revision 1.11 2004/06/07 19:44:12 fredo cleaned out cr+lf for lf
Revision 1.10 2004/05/31 23:20:48 fredo added basic platform encoding independency
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