1PDF::API2::Lite(3) User Contributed Perl Documentation PDF::API2::Lite(3)
2
3
4
6 PDF::API2::Lite - lite pdf creation
7
9 $pdf = PDF::API2::Lite->new;
10 $pdf->page(595,842);
11 $img = $pdf->image('some.jpg');
12 $font = $pdf->corefont('Times-Roman');
13 $font = $pdf->ttfont('TimesNewRoman.ttf');
14
16 $pdf = PDF::API2::Lite->new
17 $pdf->page
18 $pdf->page $width,$height
19 $pdf->page $llx, $lly, $urx, $ury
20 Opens a new page.
21
22 $pdf->mediabox $w, $h
23 $pdf->mediabox $llx, $lly, $urx, $ury
24 Sets the global mediabox.
25
26 $pdf->saveas $file
27 Saves the document (may not be modified later) and deallocates the
28 pdf-structures.
29
30 $font = $pdf->corefont $fontname
31 Returns a new or existing adobe core font object.
32
33 Examples:
34
35 $font = $pdf->corefont('Times-Roman');
36 $font = $pdf->corefont('Times-Bold');
37 $font = $pdf->corefont('Helvetica');
38 $font = $pdf->corefont('ZapfDingbats');
39
40 $font = $pdf->ttfont $ttfile
41 Returns a new or existing truetype font object.
42
43 Examples:
44
45 $font = $pdf->ttfont('TimesNewRoman.ttf');
46 $font = $pdf->ttfont('/fonts/Univers-Bold.ttf');
47 $font = $pdf->ttfont('../Democratica-SmallCaps.ttf');
48
49 $font = $pdf->psfont($ps_file, [%options])
50 Returns a new type1 font object.
51
52 Examples:
53
54 $font = $pdf->psfont('TimesRoman.pfa', -afmfile => 'TimesRoman.afm', -encode => 'latin1');
55 $font = $pdf->psfont('/fonts/Univers.pfb', -pfmfile => '/fonts/Univers.pfm', -encode => 'latin2');
56
57 $egs = $pdf->create_egs
58 Returns a new extended-graphics-state object.
59
60 Examples:
61
62 $egs = $pdf->create_egs;
63
64 $img = $pdf->image_jpeg $file
65 Returns a new jpeg-image object.
66
67 $img = $pdf->image_png $file
68 Returns a new png-image object.
69
70 $img = $pdf->image_tiff $file
71 Returns a new tiff-image object.
72
73 $img = $pdf->image_pnm $file
74 Returns a new pnm-image object.
75
76 $pdf->savestate
77 Saves the state of the page.
78
79 $pdf->restorestate
80 Restores the state of the page.
81
82 $pdf->egstate $egs
83 Sets extended-graphics-state.
84
85 $pdf->fillcolor $color
86 Sets fillcolor.
87
88 $pdf->strokecolor $color
89 Sets strokecolor.
90
91 Defined color-names are:
92
93 aliceblue, antiquewhite, aqua, aquamarine, azure, beige, bisque, black, blanchedalmond,
94 blue, blueviolet, brown, burlywood, cadetblue, chartreuse, chocolate, coral, cornflowerblue,
95 cornsilk, crimson, cyan, darkblue, darkcyan, darkgoldenrod, darkgray, darkgreen, darkgrey,
96 darkkhaki, darkmagenta, darkolivegreen, darkorange, darkorchid, darkred, darksalmon,
97 darkseagreen, darkslateblue, darkslategray, darkslategrey, darkturquoise, darkviolet,
98 deeppink, deepskyblue, dimgray, dimgrey, dodgerblue, firebrick, floralwhite, forestgreen,
99 fuchsia, gainsboro, ghostwhite, gold, goldenrod, gray, grey, green, greenyellow, honeydew,
100 hotpink, indianred, indigo, ivory, khaki, lavender, lavenderblush, lawngreen, lemonchiffon,
101 lightblue, lightcoral, lightcyan, lightgoldenrodyellow, lightgray, lightgreen, lightgrey,
102 lightpink, lightsalmon, lightseagreen, lightskyblue, lightslategray, lightslategrey,
103 lightsteelblue, lightyellow, lime, limegreen, linen, magenta, maroon, mediumaquamarine,
104 mediumblue, mediumorchid, mediumpurple, mediumseagreen, mediumslateblue, mediumspringgreen,
105 mediumturquoise, mediumvioletred, midnightblue, mintcream, mistyrose, moccasin, navajowhite,
106 navy, oldlace, olive, olivedrab, orange, orangered, orchid, palegoldenrod, palegreen,
107 paleturquoise, palevioletred, papayawhip, peachpuff, peru, pink, plum, powderblue, purple,
108 red, rosybrown, royalblue, saddlebrown, salmon, sandybrown, seagreen, seashell, sienna,
109 silver, skyblue, slateblue, slategray, slategrey, snow, springgreen, steelblue, tan, teal,
110 thistle, tomato, turquoise, violet, wheat, white, whitesmoke, yellow, yellowgreen
111
112 or the rgb-hex-notation:
113
114 #rgb, #rrggbb, #rrrgggbbb and #rrrrggggbbbb
115
116 or the cmyk-hex-notation:
117
118 %cmyk, %ccmmyykk, %cccmmmyyykkk and %ccccmmmmyyyykkkk
119
120 or the hsl-hex-notation:
121
122 &hsl, &hhssll, &hhhssslll and &hhhhssssllll
123
124 and additionally the hsv-hex-notation:
125
126 !hsv, !hhssvv, !hhhsssvvv and !hhhhssssvvvv
127
128 $pdf->linedash @dash
129 Sets linedash.
130
131 $pdf->linewidth $width
132 Sets linewidth.
133
134 $pdf->transform %opts
135 Sets transformations (eg. translate, rotate, scale, skew) in pdf-
136 canonical order.
137
138 Example:
139
140 $pdf->transform(
141 -translate => [$x,$y],
142 -rotate => $rot,
143 -scale => [$sx,$sy],
144 -skew => [$sa,$sb],
145 )
146
147 $pdf->move $x, $y
148 $pdf->line $x, $y
149 $pdf->curve $x1, $y1, $x2, $y2, $x3, $y3
150 $pdf->arc $x, $y, $a, $b, $alfa, $beta, $move
151 $pdf->ellipse $x, $y, $a, $b
152 $pdf->circle $x, $y, $r
153 $pdf->rect $x,$y, $w,$h
154 $pdf->rectxy $x1,$y1, $x2,$y2
155 $pdf->poly $x1,$y1, ..., $xn,$yn
156 $pdf->close
157 $pdf->stroke
158 $pdf->fill
159 $pdf->fillstroke
160 $pdf->image $imgobj, $x,$y, $w,$h
161 $pdf->image $imgobj, $x,$y, $scale
162 $pdf->image $imgobj, $x,$y
163 Please Note: The width/height or scale given is in user-space
164 coordinates which is subject to transformations which may have been
165 specified beforehand.
166
167 Per default this has a 72dpi resolution, so if you want an image to
168 have a 150 or 300dpi resolution, you should specify a scale of
169 72/150 (or 72/300) or adjust width/height accordingly.
170
171 $pdf->textstart
172 $pdf->textfont $fontobj,$size
173 $txt->textlead $leading
174 $pdf->text $string
175 Applies the given text.
176
177 $pdf->nl
178 $pdf->textend
179 $pdf->print $font, $size, $x, $y, $rot, $just, $text
180 Convenience wrapper for shortening the textstart..textend sequence.
181
183 alfred reibenschuh
184
185
186
187perl v5.32.0 2020-07-28 PDF::API2::Lite(3)