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 34     34   277 use strict;
  34         96  
  34         1317  
4 34     34   198 use warnings;
  34         77  
  34         12509  
5              
6             our $VERSION = '3.023'; # VERSION
7             our $LAST_UPDATE = '3.020'; # 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 (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 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 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             =cut
35              
36             # see sites such as https://www.papersizes.org/ for all the paper size
37             # information you would ever want to know
38             # http://tug.ctan.org/macros/latex/contrib/memoir/memman.pdf pg 39
39              
40             sub get_paper_sizes {
41              
42             # dimensions are Width and Height in Big Points. divide by 72 to get
43             # inches, or divide by 2.83 (72/25.4) to get mm. use page and coordinate
44             # rotations to rotate into landscape mode and vice-versa.
45              
46             return (
47             # Metric sizes
48             # non-standard names 4a, 2a, 4b, 2b have been removed
49             # (use standard 4a0, 2a0, 4b0, 2b0 instead)
50 34     34 0 2927 '4a0' => [ 4760, 6716 ],
51             '2a0' => [ 3368, 4760 ],
52             'a0' => [ 2380, 3368 ],
53             'a1' => [ 1684, 2380 ],
54             'a2' => [ 1190, 1684 ],
55             'a3' => [ 842, 1190 ],
56             'a4' => [ 595, 842 ],
57             'a5' => [ 421, 595 ],
58             'a6' => [ 297, 421 ],
59             'a7' => [ 210, 297 ],
60             'a8' => [ 147, 210 ],
61             'a9' => [ 105, 147 ],
62             'a10' => [ 74, 105 ],
63             '4b0' => [ 5656, 8000 ],
64             '2b0' => [ 4000, 5656 ],
65             'b0' => [ 2828, 4000 ],
66             'b1' => [ 2000, 2828 ],
67             'b2' => [ 1414, 2000 ],
68             'b3' => [ 1000, 1414 ],
69             'b4' => [ 707, 1000 ],
70             'b5' => [ 500, 707 ],
71             'b6' => [ 353, 500 ],
72             'b7' => [ 250, 353 ],
73             'b8' => [ 176, 250 ],
74             'b9' => [ 125, 176 ],
75             'b10' => [ 88, 125 ],
76             'c0' => [ 2600, 3677 ], # C series envelopes
77             'c1' => [ 1837, 2600 ],
78             'c2' => [ 1298, 1837 ],
79             'c3' => [ 918, 1298 ],
80             'c4' => [ 649, 918 ],
81             'c5' => [ 459, 649 ],
82             'c6' => [ 323, 459 ],
83             'c7' => [ 230, 323 ],
84             'c8' => [ 162, 230 ],
85             'c9' => [ 113, 162 ],
86             'c10' => [ 79, 113 ],
87             'jis-b5' => [ 516, 729 ],
88             'folio' => [ 595, 935 ],
89             'chinese-16k' => [ 524, 737 ],
90             'chinese-32k' => [ 369, 524 ],
91             '16k' => [ 553, 765 ],
92             'jp-postcard' => [ 283, 420 ],
93             'dbl-postcard' => [ 420, 567 ],
94             'env-c5' => [ 459, 649 ],
95             'env-dl' => [ 312, 624 ],
96             'env-c6' => [ 323, 459 ],
97             'env-cho-3' => [ 340, 666 ],
98             'env-cho-4' => [ 255, 581 ],
99             'p1' => [ 1587, 2438 ], # Canadian correspondence sizes
100             'p2' => [ 1219, 1587 ],
101             'p3' => [ 794, 1219 ],
102             'p4' => [ 609, 794 ],
103             'p5' => [ 397, 609 ],
104             'p6' => [ 303, 397 ],
105              
106             # mixed
107             'universal' => [ 595, 792 ], # smaller of A4 and US Letter,
108             # will print on either paper size
109              
110             # US sizes
111             'broadsheet' => [ 1296, 1584 ], # varies, sometimes 1224 x 1584
112             'executive' => [ 522, 756 ],
113             'foolscap' => [ 576, 936 ], # also listed as 360x486
114             'gov-legal' => [ 612, 936 ],
115             'gov-letter' => [ 576, 756 ],
116             'jr-legal' => [ 360, 576 ],
117             'ledger' => [ 1224, 792 ], # = tabloid in landscape orientation
118             'legal' => [ 612, 1008 ],
119             'letter' => [ 612, 792 ],
120             'letter-plus' => [ 612, 914 ],
121             'quarto' => [ 576, 720 ],
122             'student' => [ 396, 612 ],
123             'tabloid' => [ 792, 1224 ],
124             '36x36' => [ 2592, 2592 ],
125             'dbill' => [ 216, 504 ],
126             'statement' => [ 396, 612 ], # = student
127             'old-paper' => [ 648, 864 ],
128             'half-letter' => [ 396, 612 ], # = student
129             'env-10' => [ 297, 684 ],
130             'env-monarch' => [ 279, 540 ],
131             'a' => [ 612, 791 ], # ANSI technical drawing paper
132             'b' => [ 791, 1225 ],
133             'c' => [ 1225, 1585 ],
134             'd' => [ 1585, 2449 ],
135             'e' => [ 2449, 3169 ],
136             'f' => [ 2016, 2880 ],
137             'b-plus' => [ 936, 1368 ], # aka super-B, A3+, super-A3
138             'arch-a' => [ 648, 864 ],
139             'arch-b' => [ 864, 1296 ],
140             'arch-c' => [ 1296, 1728 ],
141             'arch-d' => [ 1728, 2592 ],
142             'arch-e' => [ 2592, 3456 ],
143             'arch-e1' => [ 2160, 3024 ],
144             'pott' => [ 288, 450 ], # British sizes
145             'post' => [ 360, 576 ],
146             'large-post' => [ 378, 594 ],
147             'crown' => [ 360, 540 ],
148             'large-crown' => [ 378, 576 ],
149             'demy' => [ 409, 630 ],
150             'small-demy' => [ 409, 612 ],
151             'medium' => [ 414, 648 ],
152             'royal' => [ 450, 720 ],
153             'small-royal' => [ 445, 666 ],
154             'super-royal' => [ 486, 738 ],
155             'imperial' => [ 540, 792 ],
156             );
157             }
158              
159             1;