PDF::API2::Lite

NAME

PDF::API2:: - A lite high-level wrapper around PDF::API2 for pdf-creation only.

SYNOPSIS

use PDF::API2::Lite;

$pdf = PDF::API2::Lite->new;
$pdf->page(595,842);
$img = $pdf->image('some.jpg');
$font = $pdf->corefont('Times-Roman');
$font = $pdf->ttfont('TimesNewRoman.ttf');

METHODS

PDF::API2::Lite

$pdf = PDF::API::Lite->new
$pdf->page
$pdf->page $width,$height
$pdf->page $llx, $lly, $urx, $ury

Opens a new page.

$pdf->mediabox $w, $h
$pdf->mediabox $llx, $lly, $urx, $ury

Sets the global mediabox.

$pdf->saveas $file

Saves the document (may not be modified later) and deallocates the pdf-structures.

$font = $pdf->corefont $fontname

Returns a new or existing adobe core font object.

Examples:

$font = $pdf->corefont('Times-Roman');
$font = $pdf->corefont('Times-Bold');
$font = $pdf->corefont('Helvetica');
$font = $pdf->corefont('ZapfDingbats');
$font = $pdf->ttfont $ttfile

Returns a new or existing truetype font object.

Examples:

$font = $pdf->ttfont('TimesNewRoman.ttf');
$font = $pdf->ttfont('/fonts/Univers-Bold.ttf');
$font = $pdf->ttfont('../Democratica-SmallCaps.ttf');
$img = $pdf->loadimage $file

Returns a new image object.

Examples:

$img = $pdf->loadimage('yetanotherfun.jpg');
$img = $pdf->loadimage('truly24bitpic.png');
$img = $pdf->loadimage('reallargefile.pnm');
$pdf->savestate

Saves the state of the page.

$pdf->restorestate

Restores the state of the page.

$pdf->fillcolor $color

Sets fillcolor.

$pdf->strokecolor $color

Sets strokecolor.

Defined color-names are:

aliceblue, 
antiquewhite, 
aqua, 
aquamarine, 
azure,
beige, 
bisque, 
black, 
blanchedalmond, 
blue,
blueviolet, 
brown, 
burlywood, 
cadetblue, 
chartreuse,
chocolate, 
coral, 
cornflowerblue, 
cornsilk, 
crimson,
cyan, 
darkblue, 
darkcyan, 
darkgoldenrod, 
darkgray,
darkgreen, 
darkgrey, 
darkkhaki, 
darkmagenta,
darkolivegreen, 
darkorange, 
darkorchid, 
darkred,
darksalmon, 
darkseagreen, 
darkslateblue, 
darkslategray,
darkslategrey, 
darkturquoise, 
darkviolet, 
deeppink,
deepskyblue, 
dimgray, 
dimgrey, 
dodgerblue, 
firebrick,
floralwhite, 
forestgreen, 
fuchsia, 
gainsboro, 
ghostwhite,
gold, 
goldenrod, 
gray, 
grey, 
green, 
greenyellow,
honeydew, 
hotpink, 
indianred, 
indigo, 
ivory, 
khaki,
lavender, 
lavenderblush, 
lawngreen, 
lemonchiffon,
lightblue, 
lightcoral, 
lightcyan, 
lightgoldenrodyellow,
lightgray, 
lightgreen, 
lightgrey, 
lightpink, 
lightsalmon,
lightseagreen, 
lightskyblue, 
lightslategray,
lightslategrey, 
lightsteelblue, 
lightyellow, 
lime,
limegreen, 
linen, 
magenta, 
maroon, 
mediumaquamarine,
mediumblue, 
mediumorchid, 
mediumpurple, 
mediumseagreen,
mediumslateblue, 
mediumspringgreen, 
mediumturquoise,
mediumvioletred, 
midnightblue, 
mintcream, 
mistyrose,
moccasin, 
navajowhite, 
navy, 
oldlace, 
olive, 
olivedrab,
orange, 
orangered, 
orchid, 
palegoldenrod, 
palegreen,
paleturquoise, 
palevioletred, 
papayawhip, 
peachpuff,
peru, 
pink, 
plum, 
powderblue, 
purple, 
red, 
rosybrown,
royalblue, 
saddlebrown, 
salmon, 
sandybrown, 
seagreen,
seashell, 
sienna, 
silver, 
skyblue, 
slateblue, 
slategray,
slategrey, 
snow, 
springgreen, 
steelblue, 
tan, 
teal,
thistle, 
tomato, 
turquoise, 
violet, 
wheat, 
white,
whitesmoke, 
yellow, 
yellowgreen

or the rgb-hex-notation:

#rgb, #rrggbb, #rrrgggbbb and #rrrrggggbbbb

or the cmyk-hex-notation:

%cmyk, %ccmmyykk, %cccmmmyyykkk and %ccccmmmmyyyykkkk

and additionally the hsv-hex-notation:

!hsv, !hhssvv, !hhhsssvvv and !hhhhssssvvvv
$pdf->linedash @dash

Sets linedash.

$pdf->linewidth $width

Sets linewidth.

$pdf->transform %opts

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

Example:

$pdf->transform(
	-translate => [$x,$y],
	-rotate    => $rot,
	-scale     => [$sx,$sy],
	-skew      => [$sa,$sb],
)
$pdf->move $x, $y
$pdf->line $x, $y
$pdf->curve $x1, $y1, $x2, $y2, $x3, $y3
$pdf->arc $x, $y, $a, $b, $alfa, $beta, $move
$pdf->ellipse $x, $y, $a, $b
$pdf->circle $x, $y, $r
$pdf->rect $x,$y, $w,$h
$pdf->rectxy $x1,$y1, $x2,$y2
$pdf->poly $x1,$y1, ..., $xn,$yn
$pdf->close
$pdf->stroke
$pdf->fill
$pdf->fillstroke
$pdf->image $imgobj, $x,$y, $w,$h
$pdf->image $imgobj, $x,$y, $scale
$pdf->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.

$pdf->textstart
$pdf->textfont $fontobj,$size
$txt->textlead $leading
$pdf->text $string

Applys the given text.

$pdf->nl
$pdf->textend
$pdf->print $font, $size, $x, $y, $rot, $just, $text

Convenience wrapper for shortening the textstart..textend sequence.

AUTHOR

alfred reibenschuh

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 50:

'=item' outside of any '=over'

Around line 683:

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