PDF::Cropmarks - Add cropmarks to existing PDFs
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 --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.
The following options need to be passed to the constructor and are read-only.
The filename of the input. Required.
The filename of the output. Required.
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.
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.
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.
The length of the cropmark line.
The distance from the logical page corner and the cropmark line.
The font size of the headers and footers with the job name, date, and page numbers.
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.
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.
The (optional) job title to put on the markers. It defaults to the file basename.
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).
This is the only public method: create the new pdf from
input and leave it in
<melmothx at gmail.com>
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.
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.