Next: , Previous: Color Names, Up: Appendices

Appendix C Page Sizes and Viewport Sizes

When producing output in such vector formats as Illustrator, Postscript, PCL 5, HP-GL, and Fig, it is important to specify the size of the page on which the output will appear. Supported page sizes are "letter", "a4", etc.; a full list appears below. The page size is passed to the the GNU libplot library via the PAGESIZE parameter. The command-line graphics programs graph, plot, pic2plot, tek2plot, and plotfont, which are built on libplot, similarly support a PAGESIZE environment variable and a ‘--page-size’ option.

Graphics drawn by libplot are nominally drawn within a graphics display, or `viewport'. When producing raster formats such as PNG, PNM, and pseudo-GIF, the viewport is simply a square or rectangular bitmap. But when producing vector formats such as Illustrator, Postscript, PCL 5, HP-GL, and Fig format, the viewport is a square or rectangular region on the output page. (For the meaning of the viewport when the output format is SVG or WebCGM, see below.) Except in the HP-GL case, the viewport will by default be centered on the page. For example, if the page size is "letter", the viewport will be a square 8in by 8in region, centered on a 8.5in by 11.0in page. Graphics will not be clipped to the viewport, so the entire page will in principle be imageable.

Either or both of the dimensions of the viewport can be changed by the user. For example, the page size could be specified as "letter,xsize=4in", or "a4,xsize=10cm,ysize=15cm", where the specified sizes will override the default dimensions of the viewport. The dimensions of the viewport are allowed to be negative (a negative dimension results in a reflection). Inches, centimeters, and millimeters are the supported units.

For most vector output formats, it is possible to position the viewport quite precisely, by specifying the location of its lower left corner relative to the lower left corner of the page. For example, the page size could be specified not merely as "letter" or "a4", but as "letter,xorigin=2in,yorigin=3in", or "a4,xorigin=0.5cm,yorigin=0.5cm". (The `xorigin' and `yorigin' specifiers may be used in conjunction with `xsize' and `ysize'.) As an alternative to `xorigin' and `yorigin', the viewport position could be adjusted by supplying an offset vector, the offset being interpreted as a shift away from the default position. For example, the page size could be specified as "letter,yoffset=1.2in", or "a4,xoffset=−5mm,yoffset=2.0cm". The viewport may also be rotated, by setting the ROTATION parameter or environment variable, or (in the case of the graphics programs) by using the ‘--rotation’ option. A rotated viewport does not change the position of its four corners. Rather, the graphics are rotated within it. If the viewport is rectangular rather than square, this `rotation' will necessarily include a rescaling.

Any ISO page size in the range "a0"..."a4" or ANSI page size in the range "a"..."e" may be specified. ("letter" is an alias for "a", which is the default, and "tabloid" is an alias for "b"). "legal", "ledger", and the JIS [Japanese Industrial Standard] size "b5" are recognized also. The following are the supported page sizes and the default square viewport size that corresponds to each.

"a" (or "letter"; 8.5in by 11.0in)
"b" (or "tabloid"; 11.0in by 17.0in)
"c" (17.0in by 22.0in)
"d" (22.0in by 34.0in)
"e" (34.0in by 44.0in)
"legal" (8.5in by 14.0in)
"ledger" (17.0in by 11.0in)
"a4" (21.0cm by 29.7cm)
"a3" (29.7cm by 42.0cm)
"a2" (42.0cm by 59.4cm)
"a1" (59.4cm by 84.1cm)
"a0" (84.1cm by 118.9cm)
"b5" (18.2cm by 25.7cm)

As noted, SVG and WebCGM format are special. They have no notion of the size of the Web page on which the viewport will ultimately be positioned. They do have a notion of viewport size, though this will typically be overridden when the output file is placed on a page by a Web page designer. When producing SVG or WebCGM output, the viewport size is set in the usual way: by PAGESIZE, or (in the case of the graphics programs) the ‘--page-size’ option. For example, if the specified page size is "letter", the viewport within which SVG or WebCGM graphics are drawn will be an 8in by 8in square. If it is "letter,xsize=6in,ysize=7in", then the viewport will be a 6in by 7in rectangle, and so forth. The "xorigin", "yorigin", "xoffset", and "yoffset" specifiers, if included, are necessarily ignored.

For a similar reason, the "xorigin" and "yorigin" specifiers are ignored when producing HP-GL or HP-GL/2 output. By default, the lower left corner of the viewport is positioned at the HP-GL `scaling point' P1, whose location is device-dependent and will not normally coincide with the lower left corner of the physical page, though it may be close to it. The "xoffset" and "yoffset" specifiers are respected, however, and may be used to shift the viewport away from its default position.