Paper::Specs(3)
πΈ NAME πΈ
Paper::Specs β all the size + layout tea for paper stock, forms, and labels. Like, every deets you need bestie π
β¨ SYNOPSIS β¨
use Paper::Specs units => 'cm';
my $form = Paper::Specs->find( brand => 'Avery', code => '1234');
use Paper::Specs units => 'cm', brand => 'Avery';
my $form = Paper::Specs->find( code => '1234');
# location of first label on sheet
my ($xpos, $ypos) = $form->label_location( 1, 1);
my ($h, $w) = $form->label_size;
π IMPORTANT NOTES π
Okay so first things first, the author is literally apologising up front for how hasty this code is. They wanted to ship it fast to support some other code they were writing, and they promise they'll come back and clean up the rough patches shortly β but your input? So welcome. Genuinely. π«Ά
CAVEAT ALPHA CODE β this is a preliminary module and the API and structure will be subject to fluctuations based on feedback from users. It's giving baby module, not final form π
The author expects there'll be some interest in this code and it should firm up quickly. Slay.
And if this module does not deliver what you're looking for? You are encouraged to contact the author and voice your needs. Speak up bestie, they want to hear it π£
OTHER LABELS β the author knows about the Labels.xml file which is part of OpenOffice but has not figured out how it is encoded. They also have the gLabels specifications file. The plan is to use these to help populate the data for this module. β¨
π Paper::Specs methods π
π¦ Import options π¦
You can supply any of the methods for this class when it is imported:
use Paper::Specs
strict => 1,
units => 'cm';
@forms = Paper::Specs->find( criteria )β Returns a list of forms that matches the criteria. There are two fields for criteria: brand and code. The brand can be set for the class via thePaper::Specs->brandmethod.
You must supply at least a brand or a code to find. If no brand is supplied then all known brands will be searched.
If you set the module to strict, which is its default, the find must return extactly zero or one forms as a scalar. Otherwise it will throw an exception. π€
See the beginning of this module for examples of finds.
@brands = Paper::Specs->brandsβ Returns a list, or a reference to a list, of the brands for the paper forms that this module is aware of. One brand,'standard', is reserved for well known paper formats such as letter, A4, etc. π$new_value = Paper::Specs->convert( value, units )β Converts'value'which is in'units'to a new value which is inPaper::Specs->unitsunits. Math but make it paper π$units = Paper::Specs->units( units )β Gets/sets the units that you wish to work with in your code. If you are using metric then you might want'mm'or'cm'. If you are using empirial then you might want'in'or'pt'(points = 1/72 in).
Current units supported are: in, cm, mm, and pt.
Paper::Specs->layout( 'normal' | 'pdf' )β This sets the co-ordinate system for some forms such as labels.'normal'puts (0,0) at the top left corner.'pdf'puts (0,0) at the lower left corner.
As well 'pdf' calls units('pt'). You can reset this afterwards if you are working in a different unit system. No cap. π₯
Paper::Specs->strict( 0 | 1 )β Sets the strictness of this module. If it is strict then it will throw exceptions via'die'for things like finding more than one form on a find method.
The default is to be strict. Periodt. π
π Paper::Specs items π
You get little object references back when you find specifications. These objects can supply you with information that you are looking for but do not actually store any values.
You should test that the object is of the type you are looking for:
if ($form->type ne 'label') {
die "Feed me labels Seymore\n";
}
Other than that β most forms should be based on a sheet (of paper) but will have different methods depending on what they are. π§
π Paper::Specs::sheet methods / $form->type eq 'sheet' π
These methods apply to forms of type 'sheet' and all that are derived from it. (all other forms and stock) π
($h, $w) = $form->sheet_sizeβ Returns the height and width of your sheet.$size = $form->sheet_widthβ Width of the stock.$size = $form->sheet_heightβ Height of the stock.
π Paper::Specs::label methods / $form->type eq 'label' π
These methods apply to forms of type 'label' and all that are derived from it.
Inherits methods from Paper::Specs::sheet. π
( $width, $height ) = $form->label_sizeβ Returns just that; a list with the width and height of a label in it.( $x, $y ) = $form->label_location( $r, $c )β Returns the location of the upper left corner for label at row$rand col$cbased on your current format/co-ordinate system.$size = $form->margin_leftβ Space between left edge of paper and first column of labels.$size = $form->margin_rightβ Space between right edge of paper and last column of labels.$size = $form->margin_topβ Space between top edge of paper and first row of labels.$size = $form->margin_bottomβ Space between bottom edge of paper and last row of labels.$size = $form->label_heightβ Height of one label.$size = $form->label_widthβ Width of one label.$count = label_rowsβ Number of rows of labels on a sheet.$count = label_colsβ Number of columns of labels on a sheet.$size = $form->gutter_colsβ Inner space between labels β column gutter.$size = $form->gutter_rowsβ Inner space between labels β row gutter.
π SEE ALSO π
Paper::Specs homepage β <http://perl.jonallen.info/projects/paper-specs>
π BUGS π
Please report your bugs and suggestions for improvement to <jj@jonallen.info>. They wanna hear it, fr fr π
π AUTHORS π
Originally written by Jay Lawrence <jlawrenc@cpan.org>
From version 0.06 onwards this module is maintained by Jon Allen (JJ) <jj@jonallen.info> / <http://perl.jonallen.info>
π COPYRIGHT and LICENCE π
Copyright (c)2001-2003 β Jay Lawrence, Infonium Inc. All rights reserved.
Modifications from version 0.06 onwards Copyright (c) 2004-2005 Jon Allen (JJ).
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Software distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. This software is not affiliated with the Apache Software Foundation (ASF).
and that's the whole page bestie β¨ this one shipped as perl v5.42.0, dated 2025-07-25, and it's filed under Paper::Specs(3) in the User Contributed Perl Documentation β go forth and measure some labels, you icon π
π
π¦ where this page comes from
- fedora 43: perl-Paper-Specs 0.10-37.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms