1PDF::Builder::Page(3) User Contributed Perl DocumentationPDF::Builder::Page(3)
2
3
4

NAME

6       PDF::Builder::Page - Methods to interact with individual pages
7

METHODS

9       $page = PDF::Builder::Page->new($pdf, $parent, $index)
10           Returns a page object (called from $pdf->page()).
11
12       $page->userunit($value)
13           Sets the User Unit for this one page.  See "User Units" in
14           PDF::Builder::Docs for more information.
15
16       $page->mediabox($alias)
17       $page->mediabox($alias, -orient => 'orientation')
18       $page->mediabox($w,$h)
19       $page->mediabox($llx,$lly, $urx,$ury)
20       ($llx,$lly, $urx,$ury) = $page->mediabox()
21           Sets or gets the Media Box for this one page.  See "Media Box" in
22           PDF::Builder::Docs for more information.  The method always returns
23           the current bounds (after any set operation).
24
25       ($llx,$lly, $urx,$ury) = $page->get_mediabox()
26           Gets the Media Box corner coordinates based on best estimates or
27           the default.  These are in the order given in a mediabox call (4
28           coordinates).
29
30           This method is Deprecated, and will likely be removed in the
31           future. Use the global ($pdf) or page ($page) mediabox() call with
32           no parameters instead.
33
34       $page->cropbox($alias)
35       $page->cropbox($alias, -orient => 'orientation')
36       $page->cropbox($w,$h)
37       $page->cropbox($llx,$lly, $urx,$ury)
38       ($llx,$lly, $urx,$ury) = $page->cropbox()
39           Sets or gets the Crop Box for this one page.  See "Crop Box" in
40           PDF::Builder::Docs for more information.  The method always returns
41           the current bounds (after any set operation).
42
43       ($llx,$lly, $urx,$ury) = $page->get_cropbox()
44           Gets the Crop Box based on best estimates or the default.
45
46           This method is Deprecated, and will likely be removed in the
47           future. Use the global ($pdf) or page ($page) cropbox() call with
48           no parameters instead.
49
50       $page->bleedbox($alias)
51       $page->bleedbox($alias, -orient => 'orientation')
52       $page->bleedbox($w,$h)
53       $page->bleedbox($llx,$lly, $urx,$ury)
54       ($llx,$lly, $urx,$ury) = $page->bleedbox()
55           Sets or gets or gets the Bleed Box for this one page.  See "Bleed
56           Box" in PDF::Builder::Docs for more information.  The method always
57           returns the current bounds (after any set operation).
58
59       ($llx,$lly, $urx,$ury) = $page->get_bleedbox()
60           Gets the Bleed Box based on best estimates or the default.
61
62           This method is Deprecated, and will likely be removed in the
63           future. Use the global ($pdf) or page ($page) bleedbox() call with
64           no parameters instead.
65
66       $page->trimbox($alias)
67       $page->trimbox($alias, -orient => 'orientation')
68       $page->trimbox($w,$h)
69       $page->trimbox($llx,$lly, $urx,$ury)
70       ($llx,$lly, $urx,$ury) = $page->trimbox()
71           Sets or gets the Trim Box for this one page.  See "Trim Box" in
72           PDF::Builder::Docs for more information.  The method always returns
73           the current bounds (after any set operation).
74
75       ($llx,$lly, $urx,$ury) = $page->get_trimbox()
76           Gets the Trim Box based on best estimates or the default.
77
78           This method is Deprecated, and will likely be removed in the
79           future. Use the global ($pdf) or page ($page) trimbox() call with
80           no parameters instead.
81
82       $page->artbox($alias)
83       $page->artbox($alias, -orient => 'orientation')
84       $page->artbox($w,$h)
85       $page->artbox($llx,$lly, $urx,$ury)
86       ($llx,$lly, $urx,$ury) = $page->artbox()
87           Sets or gets the Art Box for this one page.  See "Art Box" in
88           PDF::Builder::Docs for more information.  The method always returns
89           the current bounds (after any set operation).
90
91       ($llx,$lly, $urx,$ury) = $page->get_artbox()
92           Gets the Art Box based on best estimates or the default.
93
94           This method is Deprecated, and will likely be removed in the
95           future. Use the global ($pdf) or page ($page) artbox() call with no
96           parameters instead.
97
98       $page->rotate($deg)
99           Rotates the page by the given degrees, which must be a multiple of
100           90.  An angle that is not a multiple of 90 will be rounded to the
101           nearest 90 degrees, with a message.  Note that the rotation angle
102           is clockwise for a positive amount!  E.g., a rotation of +90 (or
103           -270) will have the bottom edge of the paper at the left of the
104           screen.
105
106           (This allows you to auto-rotate to landscape without changing the
107           mediabox!)
108
109           Do not confuse this "rotate()" call with the graphics context
110           rotation (Content.pm) "rotate()", which permits any angle, is of
111           opposite direction, and does not shift the origin!
112
113       $gfx = $page->gfx($prepend)
114       $gfx = $page->gfx()
115           Returns a graphics content object.  If $prepend is true, the
116           content will be prepended to the page description.  Otherwise, it
117           will be appended.
118
119           You may have more than one gfx object. They and text objects will
120           be output as objects and streams in the order defined, with all
121           actions pertaining to this gfx object appearing in one stream.
122           However, note that graphics and text objects are not fully
123           independent of each other: the exit state (linewidth, strokecolor,
124           etc.) of one object is the entry state of the next object in line
125           to be output, and so on.
126
127           If you intermix multiple gfx and text objects on a page, the
128           results may be confusing. Say you have $gfx1, $text1, $gfx2, and
129           $text2 on your page (created in that order). PDF::Builder will
130           output all the $gfx1->action calls in one stream, then all the
131           $text1->action calls in the next stream, and likewise for $gfx2
132           usage and finally $text2.
133
134           Then it's PDF's turn to confuse you. PDF will process the entire
135           $gfx1 object stream, accumulating the graphics state to the end of
136           the stream, and using that as the entry state into $text1. In a
137           similar manner, $gfx2 and $text2 are read, processed, and rendered.
138           Thus, a change in, say, the dash pattern in the middle of $gfx1,
139           after you have output some $gfx2, $text1, and $text2 material, may
140           suddenly show up at the beginning of $text1 (and continue through
141           $gfx2 and $text2)!
142
143           It is possible to use multiple graphics objects, to avoid having to
144           change settings constantly, but you may want to consider resetting
145           all your settings at the first call to each object, so that you are
146           starting from a known base.  This may most easily be done by using
147           $type->restore() and ->save() just after creating $type:
148
149            $text1 = $page->text();
150              $text1->save();
151            $grfx1 = $page->gfx();
152              $grfx1->restore();
153              $grfx1->save();
154            $text2 = $page->text();
155              $text2->restore();
156              $text2->save();
157            $grfx2 = $page->gfx();
158              $grfx1->restore();
159
160       $txt = $page->text($prepend)
161       $txt = $page->text()
162           Returns a text content object.  If $prepend is true, the content
163           will be prepended to the page description.  Otherwise, it will be
164           appended.
165
166           Please see the discussion above in "gfx()" regarding multiple
167           graphics and text objects on one page, how they are grouped into
168           PDF objects and streams, and the rendering consequences of running
169           through one entire object at a time, before moving on to the next.
170
171           The text object has many settings and attributes of its own, but
172           shares many with graphics (gfx), such as strokecolor, fillcolor,
173           linewidth, linedash, and the like. Thus there is some overlap in
174           attributes, and graphics and text calls can affect each other.
175
176       $ant = $page->annotation()
177           Returns a new annotation object.
178
179       $page->resource($type, $key, $obj)
180           Adds a resource to the page-inheritance tree.
181
182           Example:
183
184               $co->resource('Font', $fontkey, $fontobj);
185               $co->resource('XObject', $imagekey, $imageobj);
186               $co->resource('Shading', $shadekey, $shadeobj);
187               $co->resource('ColorSpace', $spacekey, $speceobj);
188
189           Note: You only have to add the required resources if they are NOT
190           handled by the *font*, *image*, *shade* or *space* methods.
191
192
193
194perl v5.32.1                      2021-03-29             PDF::Builder::Page(3)
Impressum