svgutils-0.1: Helper functions for dealing with SVG files

Data.SVG.Paper

Description

A module with a helper function for dealing with paper sizes.

Synopsis

Documentation

parsePaperSize :: String -> Maybe SizeSource

Parses a paper size which can either be a known name or a detailed size.

Paper sizes such as "a4" are not part of the SVG specification; this helper is provided here in case you want help getting a paper size from a command-line argument.

This recognises two styles of paper size. One is a literal name from the list below, and the other is "width*height" (no spaces around the asterisk) where width and height are valid SVG sizes that can be parsed by parseCoord (using a DPI of 90). The list of literal sizes, recognised case-insensitive (most of which are from the ISO 216 standard), is:

  • "a4", "a4portrait": 210mm*297mm
  • "a4landscape": 297mm*210mm
  • "a3", "a3portrait": 297mm*420mm
  • "a3landscape": 420mm*297mm
  • "letter": 215.9mm*279.4mm