Paper::Specs

Paper::Specs provides size and layout information for common paper sizes and label formats. This allows uses of your application to request output formatted for (say) A4 or US Letter paper, the module will then converts these names into absolute sizes (in cm, mm, inches, or points).

Download

Paper::Specs supports most standard paper types (A4, A3, etc), photo paper sizes (7x5, 10x8, etc) and Avery label formats.

Usage
The following example demonstrates how to use Paper::Specs to find the size of an A4 page:

use strict;
use warnings;
use Paper::Specs;

my $units      = 'cm';
my $paper_size = 'A4';

Paper::Specs->units($units);

if (my $page = Paper::Specs->find(code=>$paper_size)) {
  my $width  = $page->sheet_width;
  my $height = $page->sheet_height;
  print "$paper_size paper is $width $units x $height $units\n"
} else {
  warn "No information for paper size $paper_size\n";
}

Running this example prints:

A4 paper is 21 cm x 29.7 cm

History
I took over maintanance of Paper::Specs from the author, Jay Lawrence, on 20 December 2004.

Documentation
For full documentation please see the Paper::Specs page on CPAN.

Copyright and License
Copyright © 2001-2003 - Jay Lawrence, Infonium Inc.
Modifications from version 0.06 onwards Copyright © 2004-2007 Jon Allen (JJ)

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.