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

NAME

6       PDF::Builder::Util - utility package for often-used methods across the
7       package.
8
9   PREDEFINED COLORS
10       See the source of PDF::Builder::Resource::Colors for a complete list.
11
12       Please Note: This is an amalgamation of the X11, SGML and (X)HTML
13       specification sets.
14
15       There are many color model conversion and input conversion routines
16       defined here.
17
18   STREAM FILTERS
19       There are a number of functions here to handle stream filtering.
20
21   PREDEFINED GLYPH-NAMES
22       See the file "uniglyph.txt" for a complete list.
23
24       Please Note: You may notice that apart from the 'AGL/WGL4', names from
25       the XML, (X)HTML and SGML specification sets have been included to
26       enable interoperability towards PDF.
27
28       There are a number of functions here to handle various aspects of glyph
29       identification.
30
31   PREDEFINED PAPER SIZES
32       Dimensions are in points.
33
34       @box_corners = paper_size($x1,$y1, $x2,$y2);
35           Returns an array ($x1,$y1, $x2,$y2) (full bounding box).
36
37       @box_corners = paper_size($x1,$y1);
38           Returns an array (0,0, $x1,$y1) (half bounding box).
39
40       @box_corners = paper_size($media_name);
41           Returns an array (0,0, paper_width,paper_height) for the named
42           media.
43
44       @box_corners = paper_size($x1);
45           Returns an array (0,0, $x1,$x1) (single quadratic).
46
47           Otherwise, array (0,0, 612,792) (US Letter dimensions) is returned.
48
49       %sizes = getPaperSizes();
50           Returns a hash containing the available paper size aliases as keys
51           and their dimensions as a two-element array reference.
52
53           See the source of PDF::Builder::Resource::PaperSizes for the
54           complete list.
55
56   STRING TO DIMENSION
57       Convert a string "number [unit]" to the value in desired units. Units
58       are case-insensitive (the input is first folded to lower case).
59
60       Supported units: mm, cm, in (inch), pt (Big point, 72/inch), ppt
61       (printer's point, 72.27/inch), pc (pica, 6/inch), dd (Didot point,
62       67.5532/inch), and cc (Ciceros, 5.62943/inch). More can be added
63       easily.  Invalid units are a fatal error.
64
65       $value = str2dim($string, $type, $default_units);
66           $string contains a number and optionally, a unit. Space(s) between
67           the number and the unit are optional. E.g., '200', '35.2 mm', and
68           '1.5in' are all allowable input strings.
69
70           $type is for validation of the input $string's numeric value. The
71           first character is i for an integer is required (no decimal point),
72           or f for other (floating point) numbers. Next is an optional c to
73           indicate that an out-of-range input value is to be silently clamped
74           to be within the given range (the default is to raise a fatal
75           error). Finally, an optional range expression: {lower limit,upper
76           limit}. The limits are either numbers or * (to indicate +/-
77           infinity (no limit) on that end of the range). { is [ to say that
78           the lower limit is included in the range, while ( says that the
79           lower limit is excluded from the range. Likewise, } is ] for
80           included upper limit, and ) for excluded. The limits (and silent
81           clamping, or fatal error if the input is out of range) are against
82           the input value, before conversion to the output units.
83
84           Example types:
85
86           'f(*,*)'  no limits (the default) -- all values OK
87           'i(0,*)'  integer greater than 0
88           'fc[-3.2,7.86]'  a number between -3.2 and 7.86, with value clamped
89           to be within that range (including the endpoints)
90
91           $default_units is a required string, giving the units that the
92           input is converted to. For example, if the default units are 'pt',
93           and the input string '2 in', the output value would be '144'. If
94           the input string has no explicit units, it is assumed to be in the
95           default units (no conversion is done).
96
97
98
99perl v5.34.0                      2021-07-22             PDF::Builder::Util(3)
Impressum