NAME
PDF::Labels - Routines to produce formatted pages of mailing labels in PDF
SYNOPSIS
use PDF::Labels;
Requires: PDF::Create
DESCRIPTION
GENERAL
Provides package PDF::Labels
Package Global Variables:
@PDF::Labels:PageFormats is a list of known page formats. Each
page format is a : delimited list of fields which provide the
following properties about a page of labels:
pagewidth Width of actual page in inches
pageheight Height of actual page in inches
pagexoffset Offset from left edge of page to left
edge of first column of labels in inches
pageyoffset Offset from bottom edge of page to
bottom edge of lowest row of labels
xlabels Number of labels in each row
ylabels Number of labels in each column
labelwidth Width of each label in inches, including
margin
labelheight Height of each label in inches, including
margin
labelxmar Minimum Distance to offset printing from
left and right edges of label
labelymar Minimum distance to offset printing from
top and bottom edges of label
fontsize Size of font to use with this label
linespacing Line spacing (points) to use with this
label
SYNTAX
Example
use PDF::Create;
use PDF::Labels;
$pdf = new PDF::Labels(
$PDF::Labels::PageFormats[0],
filename=>'labels.pdf',
Author=>'PDF Labelmaker',
Title=>'My Labels'
);
$pdf->setlabel(5); # Start with label 5 on first page
$pdf->label('John Doe', '1234 Some Street',
'Anytown, ID', '12345');
$pdf->label('Jane Doe', '5493 Other Drive',
'Nowhere, CA', '92213');
$pdf->label('Bob Smith', '392 Cedar Lane',
'Deep Shit, AR', '72134');
$pdf->close();
The above example will produce 3 labels on an 8.5x11 sheet with
three labels in a row and 10 rows of labels. The labels are
2.625"x1". This is a common sheet-feed label. In this case, the
three labels will be the last label of the second row and the
first two labels of the third row. The labels can be moved by
changing the parameter to the setlabel call.
Creation
$pdf = new PDF::Labels(
$PageFormat,
PDF::Create parameters
)
$PageFormat is a string containing a single element of PageFormats
or a custom page format specification in the same format.
PDF::Create parameters are described in the PDF::Create pod.
Setup
$pdf->setlabel(n)
n is a number from 0 to maxlabels. Subsequent calls to create
labels will create labels starting from this position on the
page. Position 0 is the upper left label, working across each
row down in columns.
i.e. 0 1 2
3 4 5
6 7 8
...
Setlabel will not go backwards. If n is less than the current
cursor position, a new page will be created.
Label Creation
$pdf->label('string1', 'string2', 'string3'[, 'string4'...])
As much of each string as possible will be placed on a seperate
line of the label. If there are more strings than the label can
hold, extra strings will not be printed.
@(#) Labels.pm Last updated 01/02/10 18:59:54 (SCCS Version 1.8)
AUTHOR
Owen DeLong, owen@delong.com