The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PDF::Cropmarks - Add cropmarks to existing PDFs

VERSION

Version 0.11

SYNOPSIS

This module prepares PDF for printing adding the cropmarks, usually on a larger physical page, doing the same thing the LaTeX package "crop" does. It also takes care of the paper thickness, shifting the logical pages to compensate the folding.

It comes with a ready-made script, pdf-cropmarks.pl. E.g.

 $ pdf-cropmarks.pl --help # usage
 $ pdf-cropmarks.pl --paper a3 input.pdf output.pdf

To use the module in your code:

  use strict;
  use warnings;
  use PDF::Cropmarks;
  PDF::Cropmarks->new(input => $input,
                      output => $output,
                      paper => $paper,
                      # other options here
                     )->add_cropmarks;

If everything went well (no exceptions thrown), you will find the new pdf in the output you provided.

ACCESSORS

The following options need to be passed to the constructor and are read-only.

input <file>

The filename of the input. Required.

output

The filename of the output. Required.

paper

This module each logical page of the original PDF into a larger physical page, adding the cropmarks in the margins. With this option you can control the dimension of the output paper.

You can specify the dimension providing a (case insensitive) string with the paper name (2a, 2b, 36x36, 4a, 4b, a0, a1, a2, a3, a4, a5, a6, b0, b1, b2, b3, b4, b5, b6, broadsheet, executive, ledger, legal, letter, tabloid) or a string with width and height separated by a column, like 11cm:200mm. Supported units are mm, in, pt and cm.

An exception is thrown if the module is not able to parse the input provided.

Positioning

The following options control where the logical page is put on the physical one. They all default to true, meaning that the logical page is centered. Setting top and bottom to false, or inner and outer to false makes no sense (you achieve the same result specifing a paper with the same width or height) and thus ignored, resulting in a centering.

top
bottom
inner
outer

twoside

Boolean, defaults to true.

This option affects the positioning, if inner or outer are set to false. If twoside is true (default), inner margins are considered the left ones on an the recto pages (the odd-numbered ones). If set to false, the left margin is always considered the inner one.

cropmark_length

Default: 12mm

The length of the cropmark line.

cropmark_offset

Default: 3mm

The distance from the logical page corner and the cropmark line.

font_size

Default: 8pt

The font size of the headers and footers with the job name, date, and page numbers.

signature

Default to 0, meaning that no signature is needed. If set to 1, means that all the pages should fit in a single signature, otherwise it should be a multiple of 4.

paper_thickness

When passing the signature option, the logical pages are shifted on the x axys by this amount to compensate the paper folding. Accept a measure.

This option is active only when the signature is set (default to false) and twoside is true (the default). Default to 0.1mm, which is appropriate for the common paper 80g/m2. You can do the math measuring a stack height and dividing by the number of sheets.

title

The (optional) job title to put on the markers. It defaults to the file basename.

cover

Relevant if signature is passed. Usually the last signature is filled with blank pages until it's full. With this option turned on, the last page of the document is moved to the end of the stack. If you have 13 pages, and a signature of 4, you will end up with 16 pages with cropmarks, and the last three empty. With this option you will have page 16 with the logical page 13 on it, while the pages 13-14-15 will be empty (but with cropmarks nevertheless).

METHODS

add_cropmarks

This is the only public method: create the new pdf from input and leave it in output.

AUTHOR

Marco Pessotto, <melmothx at gmail.com>

BUGS

Please report any bugs or feature requests to the CPAN's RT or at https://github.com/melmothx/pdf-cropmarks-perl/issues. If you find a bug, please provide a minimal example file which reproduces the problem.

LICENSE

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.