File Coverage

blib/lib/PDF/Builder/Resource/PaperSizes.pm
Criterion Covered Total %
statement 7 7 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 10 11 90.9


line stmt bran cond sub pod time code
1             package PDF::Builder::Resource::PaperSizes;
2              
3 39     39   286 use strict;
  39         88  
  39         1814  
4 39     39   212 use warnings;
  39         76  
  39         21784  
5              
6             our $VERSION = '3.028'; # VERSION
7             our $LAST_UPDATE = '3.027'; # manually update whenever code is changed
8              
9             =head1 NAME
10              
11             PDF::Builder::Resource::PaperSizes - List of standard paper sizes and their dimensions
12              
13             =head2 Information and Usage
14              
15             This is a list of standard page (media) sizes by I<name> (e.g., 'A4' or
16             'Legal'), given by width and height in Big Points (72 per inch). See the code
17             in PaperSizes.pm for the actual entries. You do B<not> have to use these names;
18             they are merely provided as convenient shortcuts. You can always specify the
19             desired dimensions (in points) yourself.
20              
21             The PDF specification (and PDF readers) default to US Letter size (portrait
22             orientation, 8.5 inches wide by 11 inches high). If you want to use anything
23             else, you will have to make a C<mediabox()> call to specify the media (paper)
24             size. For named sizes, capitalization doesn't matter (all entries are folded
25             to lower case, so 'A4' and 'a4' work the same).
26              
27             Different sources give somewhat different paper dimensions, especially for
28             archaic or unusual sizes, so take care and measure your actual paper before
29             printing, so you can avoid wasting paper and time printing to the wrong
30             mediabox! Also keep in mind that many printers cannot print all the way to the
31             edge (don't want to get ink or toner on the paper rollers), so set your margins
32             accordingly.
33              
34             =head2 Available named media sizes, and size
35              
36             You can certainly edit this module to add more named sizes, if you wish to.
37             Or, you can directly give the desired size in Points, in a "box" method.
38              
39             B<CAUTION:> Before using one of the larger sizes, check if your PDF reader
40             and/or printer will be able to handle it. The official PDF definition only
41             allows up to 200 inches square (14400 Points square), requiring the use of
42             User Units to handle larger media. Many non-Adobe systems ignore this
43             limitation and support much larger sizes, but you should check before doing a
44             lot of work!
45              
46             =head3 Metric sizes
47              
48             4a0 -- 4760 x 6716 (1679 mm x 2639 mm)
49              
50             2a0 -- 3368 x 4760 (1188 mm x 1679 mm)
51              
52             a0 -- 2380 x 3368 (840 mm x 1188 mm)
53              
54             a1 -- 1684 x 2380 (594 mm x 840 mm)
55              
56             a2 -- 1190 x 1684 (420 mm x 594 mm)
57              
58             a3 -- 842 x 1190 (297 mm x 420 mm)
59              
60             a4 -- 595 x 842 (210 mm x 297 mm)
61              
62             a5 -- 421 x 595 (149 mm x 210 mm)
63              
64             a6 -- 297 x 421 (105 mm x 149 mm)
65              
66             a7 -- 210 x 297 (74 mm x 105 mm)
67              
68             a8 -- 147 x 210 (52 mm x 74 mm)
69              
70             a9 -- 105 x 147 (37 mm x 52 mm)
71              
72             a10 -- 74 x 105 (26 mm x 37 mm)
73              
74             4b0 -- 5656 x 8000 (1995 mm x 2822 mm)
75              
76             2b0 -- 4000 x 5656 (1411 mm x 1995 mm)
77              
78             b0 -- 2828 x 4000 (998 mm x 1411 mm)
79              
80             b1 -- 2000 x 2828 (706 mm x 998 mm)
81              
82             b2 -- 1414 x 2000 (499 mm x 706 mm)
83              
84             b3 -- 1000 x 1414 (353 mm x 499 mm)
85              
86             b4 -- 707 x 1000 (249 mm x 353 mm)
87              
88             b5 -- 500 x 707 (176 mm x 249 mm)
89              
90             b6 -- 353 x 500 (125 mm x 176 mm)
91              
92             b7 -- 250 x 353 (88 mm x 125 mm)
93              
94             b8 -- 176 x 250 (62 mm x 88 mm)
95              
96             b9 -- 125 x 176 (44 mm x 62 mm)
97              
98             b10 -- 88 x 125 (31 mm x 44 mm)
99              
100             c0 -- 2600 x 3677 (917 mm x 1297 mm) Envelope sizes
101              
102             c1 -- 1837 x 2600 (648 mm x 917 mm)
103              
104             c2 -- 1298 x 1837 (458 mm x 648 mm)
105              
106             c3 -- 918 x 1298 (324 mm x 458 mm)
107              
108             c4 -- 649 x 918 (229 mm x 324 mm)
109              
110             c5 -- 459 x 649 (162 mm x 229 mm)
111              
112             c6 -- 323 x 459 (114 mm x 162 mm)
113              
114             c7 -- 230 x 323 (81 mm x 114 mm)
115              
116             c8 -- 162 x 230 (57 mm x 81 mm)
117              
118             c9 -- 113 x 162 (40 mm x 57 mm)
119              
120             c10 -- 79 x 113 (28 mm x 40 mm)
121              
122             jis-b5 -- 516 x 729 (182 mm x 257 mm)
123              
124             folio -- 595 x 935 (210 mm x 330 mm)
125              
126             chinese-16k -- 524 x 737 (185 mm x 260 mm)
127              
128             chinese-32k -- 369 x 524 (130 mm x 185 mm)
129              
130             16k -- 553 x 765 (195 mm x 270 mm)
131              
132             jp-postcard -- 283 x 420 (100 mm x 148 mm)
133              
134             dbl-postcard -- 420 x 567 (148 mm x 200 mm)
135              
136             env-c5 -- 459 x 649 (162 mm x 229 mm)
137              
138             env-dl -- 312 x 624 (110 mm x 220 mm)
139              
140             env-c6 -- 323 x 459 (114 mm x 162 mm)
141              
142             env-cho-3 -- 340 x 666 (120 mm x 235 mm)
143              
144             env-cho-4 -- 255 x 581 (90 mm x 205 mm)
145              
146             p1 -- 1587 x 2438 (560 mm x 860 mm) Canadian correspondence
147              
148             p2 -- 1219 x 1587 (430 mm x 560 mm)
149              
150             p3 -- 794 x 1219 (280 mm x 430 mm)
151              
152             p4 -- 609 x 794 (215 mm x 280 mm)
153              
154             p5 -- 397 x 609 (140 mm x 215 mm)
155              
156             p6 -- 303 x 397 (107 mm x 140 mm)
157              
158             =head3 Mixed sizes
159              
160             universal -- 595 x 792 (210 mm x 11 in)
161              
162             This is not a standard or official size, but a PDF::Builder size, which should
163             print OK on either A4 or US Letter paper size. It is narrow (like A4) and short
164             (like letter). Your content will be in the lower left of the paper, when
165             printed, with extra top margin on A4 or extra right margin on Letter.
166              
167             =head3 US/British (non-metric) sizes
168              
169             broadsheet -- 1296 x 1584 (18 in x 22 in) sometimes 1224 x 1584!
170              
171             executive -- 522 x 756 (7.25 in x 10.5 in)
172              
173             foolscap -- 576 x 936 (8 in x 13 in) sometimes 360 x 486!
174              
175             gov-legal -- 612 x 936 (8.5 in x 13 in)
176              
177             gov-letter -- 576 x 756 (8 in x 10.5 in)
178              
179             jr-legal -- 360 x 576 (5 in x 8 in)
180              
181             ledger -- 1224 x 792 (17 in x 11 in)
182              
183             legal -- 612 x 1008 (8.5 in x 14 in)
184              
185             letter -- 612 x 792 (8.5 in x 11 in)
186              
187             letter-plus -- 612 x 914 (8.5 in x 12.7 in)
188              
189             quarto -- 576 x 720 (8 in x 10 in)
190              
191             student -- 396 x 612 (5.5 in x 8.5 in) a.k.a. statement, half-letter
192              
193             tabloid -- 792 x 1224 (11 in x 17 in) ledger rotated (portrait mode)
194              
195             36x36 -- 2592 x 2592 (36 in x 36 in)
196              
197             dbill -- 216 x 504 (3 in x 7 in)
198              
199             old-paper -- 648 x 864 (9 in x 12 in)
200              
201             env-10 -- 297 x 684 (4.125 in x 9.5 in)
202              
203             env-monarch -- 279 x 540 (3.875 in x 7.5 in)
204              
205             a -- 612 x 791 (8.5 in x 11 in) ANSI technical drawing paper
206              
207             b -- 791 x 1225 (11 in x 17 in)
208              
209             c -- 1225 x 1585 (17 in x 22 in)
210              
211             d -- 1585 x 2449 (22 in x 34 in)
212              
213             e -- 2449 x 3169 (34 in x 44 in)
214              
215             f -- 2016 x 2880 (28 in x 40 in)
216              
217             b-plus -- 936 x 1368 (13 in x 19 in) a.k.a. super-B, A3+, super-A3
218              
219             arch-a -- 648 x 864 (9 in x 12 in)
220              
221             arch-b -- 864 x 1296 (12 in x 18 in)
222              
223             arch-c -- 1296 x 1728 (18 in x 24 in)
224              
225             arch-d -- 1728 x 2592 (24 in x 36 in)
226              
227             arch-e -- 2592 x 3456 (36 in x 48 in)
228              
229             arch-e1 -- 2160 x 3024 (30 in x 42 in)
230              
231             pott -- 288 x 450 (3.9 in x 6.25 in) British sizes
232              
233             post -- 360 x 576 (5 in x 8 in)
234              
235             large-post -- 378 x 594 (5.25 in x 8.25 in)
236              
237             crown -- 360 x 540 (5 in x 7.5 in)
238              
239             large-crown -- 378 x 576 (5.25 in x 8 in)
240              
241             demy -- 409 x 630 (5.68 in x 8.75 in)
242              
243             small-demy -- 409 x 612 (5.68 in x 8.5 in)
244              
245             medium -- 414 x 648 (5.75 in x 9 in)
246              
247             royal -- 450 x 720 (6.25 in x 10 in)
248              
249             small-royal -- 445 x 666 (6.18 in x 9.25 in)
250              
251             super-royal -- 486 x 738 (6.75 in x 10.25 in)
252              
253             imperial -- 540 x 792 (7.5 in x 11 in)
254              
255             =cut
256              
257             # see sites such as https://www.papersizes.org/ for all the paper size
258             # information you would ever want to know
259             # http://tug.ctan.org/macros/latex/contrib/memoir/memman.pdf pg 39
260              
261             sub get_paper_sizes {
262              
263             # dimensions are Width and Height in Big Points. divide by 72 to get
264             # inches, or divide by 2.83 (72/25.4) to get mm. use page and coordinate
265             # rotations to rotate into landscape mode and vice-versa.
266              
267             return (
268             # Metric sizes
269             # non-standard names 4a, 2a, 4b, 2b have been removed
270             # (use standard 4a0, 2a0, 4b0, 2b0 instead)
271 42     42 0 5648 '4a0' => [ 4760, 6716 ],
272             '2a0' => [ 3368, 4760 ],
273             'a0' => [ 2380, 3368 ],
274             'a1' => [ 1684, 2380 ],
275             'a2' => [ 1190, 1684 ],
276             'a3' => [ 842, 1190 ],
277             'a4' => [ 595, 842 ],
278             'a5' => [ 421, 595 ],
279             'a6' => [ 297, 421 ],
280             'a7' => [ 210, 297 ],
281             'a8' => [ 147, 210 ],
282             'a9' => [ 105, 147 ],
283             'a10' => [ 74, 105 ],
284             '4b0' => [ 5656, 8000 ],
285             '2b0' => [ 4000, 5656 ],
286             'b0' => [ 2828, 4000 ],
287             'b1' => [ 2000, 2828 ],
288             'b2' => [ 1414, 2000 ],
289             'b3' => [ 1000, 1414 ],
290             'b4' => [ 707, 1000 ],
291             'b5' => [ 500, 707 ],
292             'b6' => [ 353, 500 ],
293             'b7' => [ 250, 353 ],
294             'b8' => [ 176, 250 ],
295             'b9' => [ 125, 176 ],
296             'b10' => [ 88, 125 ],
297             'c0' => [ 2600, 3677 ], # C series envelopes
298             'c1' => [ 1837, 2600 ],
299             'c2' => [ 1298, 1837 ],
300             'c3' => [ 918, 1298 ],
301             'c4' => [ 649, 918 ],
302             'c5' => [ 459, 649 ],
303             'c6' => [ 323, 459 ],
304             'c7' => [ 230, 323 ],
305             'c8' => [ 162, 230 ],
306             'c9' => [ 113, 162 ],
307             'c10' => [ 79, 113 ],
308             'jis-b5' => [ 516, 729 ],
309             'folio' => [ 595, 935 ],
310             'chinese-16k' => [ 524, 737 ],
311             'chinese-32k' => [ 369, 524 ],
312             '16k' => [ 553, 765 ],
313             'jp-postcard' => [ 283, 420 ],
314             'dbl-postcard' => [ 420, 567 ],
315             'env-c5' => [ 459, 649 ],
316             'env-dl' => [ 312, 624 ],
317             'env-c6' => [ 323, 459 ],
318             'env-cho-3' => [ 340, 666 ],
319             'env-cho-4' => [ 255, 581 ],
320             'p1' => [ 1587, 2438 ], # Canadian correspondence sizes
321             'p2' => [ 1219, 1587 ],
322             'p3' => [ 794, 1219 ],
323             'p4' => [ 609, 794 ],
324             'p5' => [ 397, 609 ],
325             'p6' => [ 303, 397 ],
326              
327             # mixed
328             'universal' => [ 595, 792 ], # smaller of A4 and US Letter,
329             # will print on either paper size
330              
331             # US sizes
332             'broadsheet' => [ 1296, 1584 ], # varies, sometimes 1224 x 1584
333             'executive' => [ 522, 756 ],
334             'foolscap' => [ 576, 936 ], # also listed as 360x486
335             'gov-legal' => [ 612, 936 ],
336             'gov-letter' => [ 576, 756 ],
337             'jr-legal' => [ 360, 576 ],
338             'ledger' => [ 1224, 792 ], # = tabloid in landscape orientation
339             'legal' => [ 612, 1008 ],
340             'letter' => [ 612, 792 ],
341             'letter-plus' => [ 612, 914 ],
342             'quarto' => [ 576, 720 ],
343             'student' => [ 396, 612 ],
344             'tabloid' => [ 792, 1224 ],
345             '36x36' => [ 2592, 2592 ],
346             'dbill' => [ 216, 504 ],
347             'statement' => [ 396, 612 ], # = student
348             'old-paper' => [ 648, 864 ],
349             'half-letter' => [ 396, 612 ], # = student
350             'env-10' => [ 297, 684 ],
351             'env-monarch' => [ 279, 540 ],
352             'a' => [ 612, 791 ], # ANSI technical drawing paper
353             'b' => [ 791, 1225 ],
354             'c' => [ 1225, 1585 ],
355             'd' => [ 1585, 2449 ],
356             'e' => [ 2449, 3169 ],
357             'f' => [ 2016, 2880 ],
358             'b-plus' => [ 936, 1368 ], # aka super-B, A3+, super-A3
359             'arch-a' => [ 648, 864 ],
360             'arch-b' => [ 864, 1296 ],
361             'arch-c' => [ 1296, 1728 ],
362             'arch-d' => [ 1728, 2592 ],
363             'arch-e' => [ 2592, 3456 ],
364             'arch-e1' => [ 2160, 3024 ],
365             'pott' => [ 288, 450 ], # British sizes
366             'post' => [ 360, 576 ],
367             'large-post' => [ 378, 594 ],
368             'crown' => [ 360, 540 ],
369             'large-crown' => [ 378, 576 ],
370             'demy' => [ 409, 630 ],
371             'small-demy' => [ 409, 612 ],
372             'medium' => [ 414, 648 ],
373             'royal' => [ 450, 720 ],
374             'small-royal' => [ 445, 666 ],
375             'super-royal' => [ 486, 738 ],
376             'imperial' => [ 540, 792 ],
377             );
378             }
379              
380             1;