NAME
psbind - Transform PostScript files to save trees and reduce guilt
SYNOPSIS
psbind [option]... [input-file-name [output-file-name]]
DESCRIPTION
psbind
examines the margins in a PostScript document and rearranges the pages to fit them onto paper efficiently. It outputs a transformed PostScript document.
Because psbind
detects the margins in its input automatically, it is particularly useful on documents with large or unbalanced margins. For example, many PostScript documents are laid out for paper sizes smaller than A4 or Letter. psbind
can place two such pages onto one output page, often without shrinking the text. It is also useful for printing documents formatted for A4 paper on Letter stock, or vice versa.
The simplest way to invoke psbind
is without any arguments, as in:
psbind
By default, psbind
reads a PostScript document from standard input and reformats it 2-up (i.e., placing two input pages on each output page). It leaves approximately 1/4 inch (6 mm) margins, and writes the result to standard output.
By adding command line options, you can:
Place a different number of input pages onto each output page (e.g.,
psbind -4
).Recenter the text on each page without combining pages (
psbind -C
).Simply trim off the margins, for further processing by another program (
psbind -T
).Send the output to a printer (
psbind -Pprinter-name
) or a file.Fine-tune output formatting (e.g.,
psbind --margin=2cm
), margin detection (e.g.,psbind --sample=2-10
), and other options.
The rest of this document describes how.
OPTIONS
In addition to specifying the options described below to psbind
on the command line, you can put them in an environment variable named PSBIND
. As one might expect, options specified in this environment variable can be overridden on the command line.
Input and output locations
You can invoke psbind
with zero, one, or two file names on the command line.
If you invoke
psbind
with no file name on the command line, it acts as a filter. In other words, it reads a PostScript document from standard input and writes a transformed document to standard output.psbind
If you invoke
psbind
with one file name on the command line, it reads from the specified file and writes to standard output.psbind input-file-name
If you invoke
psbind
with two file names on the command line, it reads from the first file and writes to the second file. If the second file already exists, it will be overwritten.psbind input-file-name output-file-name
You can also send the output directly to a printer.
- -P/--printer=printer-name
-
Send output to printer.
Send the transformed PostScript document to the specified printer by invoking
lpr
. This option cannot be specified in conjunction with an output file name.
Output formatting options
You can tell psbind
to do one of three things: combine pages, recenter pages, or trim pages. The default is to combine pages (2-up).
- -N/--nup
-
Combine pages.
Place multiple input pages (2 by default) on each output page. Resize the material and optimize the layout to minimize wasted space. To change the number of input pages combined into each output page, use the
-n/--nup-n
option. - -C/--center
-
Recenter pages.
Shift each page by an offset so that margins are balanced between top and bottom and between left and right. Do not resize or combine pages.
- -T/--trim
-
Trim pages.
Shift each page by an offset, and change the paper size information in the document, so that there is no margin whatsoever in the output document. This option is useful only if the output of
psbind
is fed into another program for post-processing.
The following option is relevant only when combining pages (-N/--nup
) or recentering pages (-C/--center
):
- -p/--paper=a4/letter/other-paper-size
-
Set output paper size.
By default,
psbind
produces output for the default paper size returned bypaperconf
(iflibpaperg
is installed), or Letter paper (otherwise). You can use this option to switch to a different paper size: any size known tolibpaperg
(if it is installed), or A4 or Letter (otherwise).
The following options are relevant only when combining pages (-N/--nup
).
- -n/--nup-n=n
-
Set number of input pages per output page.
By default,
psbind
puts 2 input pages on each output page; this option adjusts the number. To zoom each input page to fit one output page, say-n1
. - -1, -2, ...
-
Abbreviation for
-n1
,-n2
, .... - --margin/--nup-margin=dimension
-
Set output margin.
This option specifies how much margin to leave around each output page. The default is 1/8 inch (3 mm). You can override this setting in centimeters (
0.3cm
), millimeters (3mm
), inches (0.125in
), or PostScript points (9pt
). If you do not specify a unit, PostScript points are assumed. - --border/--nup-border=dimension
-
Set output border.
This option specifies how much space to leave around each input page in the combined output. The default is 1/8 inch (3 mm).
- --magic
-
Try very hard to keep the size of the original image.
Documents generally look worse when rescaled. This is especially true of documents that contain bitmaps, be them bitmap fonts or bitmap images. The
--magic
option suppresses the default rescaling behavior ofpsbind
whenever possible. By "whenever possible" we mean whenever the unscaled originals will fit in the output, without taking--margin
or--border
into account. This option is particularly useful for documents thatpsbind
would normally decide to expand after trimming off margins.
The following options are effective at all times, but probably useful only when combining pages (-N/--nup
).
- --scoot
-
Prepend blank page to input.
Many documents show page numbers to the right on odd-numbered pages and to the left on even-numbered pages. When printing such documents 2-up, the page numbers on adjacent input pages end up next to each other and look funny. To solve this problem, this option prepends a blank page to the input, so that odd-numbered pages appear to the right, and even-numbered pages to the left.
- --tumble
-
Rotate every other output page.
Some people like to flip through their duplex documents along the short edge of the paper rather than the long edge. This option rotates every other page in the output document by 180 degrees to achieve the effect.
Margin detection options
psbind
detects margins in the input document as follows:
Run Ghostscript to compute the extent of each input page. By default, only sample the first 10 pages.
Compute the left and right margins to be the maximum amounts that would not run into any sampled extent. By default, compute separate left and right margins for odd-numbered and even-numbered pages.
Compute the top and bottom margins to be the maximum amounts that would not run into any sampled extent. By default, compute a single set of top and bottom margins for all pages.
Check if the computed margins seem strange. ("Strange" is defined as: The computed extent of odd-numbered pages, even-numbered pages, or both exceed 1200 PostScript points or fall under 100 PostScript points in either or both dimension.) If they seem strange, run Ghostscript to rewrite the input document, then try detecting the margins again.
The following options allow you to fine-tune this margin detection process.
- -s/--sample=pages
-
Choose input pages to sample.
By default, the first 10 pages are sampled from the input document to detect its margins. This options allows you to specify a different set of pages to sample. The list of
pages
should be a comma-separated list of page ranges, each of which may be a page number, or a page range of the formfirst-last
. Iffirst
is omitted, the first page is assumed, and iflast
is omitted, the last page is assumed. Negative numbers indicate that pages relative to the end of the document, counting backwards. For example, to skip page 5 (perhaps because it sticks out a little bit), say--sample=1-4,6-10
. - --xmodulus=n
-
Specify page modulus for detecting horizontal extent.
By default, left and right margins are determined separately for odd-numbered pages and even-numbered pages. This behavior corresponds to a default setting of
--xmodulus=2
. To determine a single horizontal extent for all pages taken together, say--xmodulus=1
. You can also change this setting to integers greater than 2, but it probably does not make any sense. - --ymodulus=n
-
Specify page modulus for detecting vertical extent.
By default, a single set of top and bottom margins is determined for all pages taken together. This behavior corresponds to a default setting of
--ymodulus=1
. To determine vertical extents separately for odd-numbered pages and even-numbered pages, say--ymodulus=2
. You can also change this setting to integers greater than 2, but it probably does not make any sense. - --fix=auto/no/yes/force
-
Invoke or suppress
fixps
.By default,
psbind
first tries to determine margins using the original input document; if this first attempt fails, it then invokesfixps --force
to rewrite the document for a second try. To disablefixps
invocation altogether, say--fix=no
. To invokefixps --force
right away, say--fix=force
. To invokefixps
right away (without--force
), say--fix=yes
.
Miscellaneous options
- -q/--quiet
-
Suppress status messages.
Usually,
psbind
prints external commands as it executes them. It also produces messages summarizing the margin detection process. This option suppresses these messages. - --ghostscript=program-name
- --psnup=program-name
- --pstops=program-name
- --psselect=program-name
- --fixps=program-name
- --lpr=program-name
- --paperconf=program-name
-
Specify locations of external programs.
To do its job,
psbind
invokes the external programs listed above. By default,psbind
searches for these programs under their standard names on the executable path. These options override howpsbind
invokes external programs. For example, to invokelp
instead oflpr
, saypsbind --lpr=lp
. - --help
-
Display usage information.
This option makes
psbind
display usage information and do nothing else. - --manual
-
Display complete documentation.
This option makes
psbind
display complete documentation and do nothing else.
PREREQUISITES
psbind
is a Perl program; to run it, your system needs to have Perl 5 installed (see perl(1)). psbind
also requires Ghostscript with bbox
device support (see gs(1)), as well as psutils
(see psnup(1), pstops(1), psselect(1), and fixps(1)).
COREQUISITES
For sending its output to a printer, psbind
relies on lpr
(see lpr(1)). For paper size information, psbind
relies on libpaperg
if it is available (see paperconf(1)).
VERSION
This version of psbind
is dated 2003-01-01.
AUTHOR AND COPYRIGHT
Copyright (c) 2001-2003, Chung-chieh Shan.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place Suite 330, Boston, MA 02111-1307, USA.
You may contact Chung-chieh Shan at:
240 Franklin St Apt 4
Cambridge, MA 02139-3986, USA
ccshan@post.harvard.edu
Latest contact information may be found on the World Wide Web at http://www.digitas.harvard.edu/~ken/
THANKS
Thanks to Dylan Thurston, Danny Calegari, Nathan Dunfield, Norman Ramsey, and Kaihsu Tai for helpful suggestions and encouragement.
README
psbind
examines the margins in a PostScript document and rearranges the pages to fit them onto paper efficiently.
SCRIPT CATEGORIES
CPAN/Administrative
14 POD Errors
The following errors were encountered while parsing the POD:
- Around line 34:
=back doesn't take any parameters, but you said =back 4
- Around line 65:
=back doesn't take any parameters, but you said =back 4
- Around line 92:
=back doesn't take any parameters, but you said =back 4
- Around line 102:
=back doesn't take any parameters, but you said =back 4
- Around line 112:
=back doesn't take any parameters, but you said =back 4
- Around line 114:
=back doesn't take any parameters, but you said =back 4
- Around line 126:
=back doesn't take any parameters, but you said =back 4
- Around line 154:
=back doesn't take any parameters, but you said =back 4
- Around line 166:
=back doesn't take any parameters, but you said =back 4
- Around line 200:
=back doesn't take any parameters, but you said =back 4
- Around line 218:
=back doesn't take any parameters, but you said =back 4
- Around line 242:
=back doesn't take any parameters, but you said =back 4
- Around line 272:
=back doesn't take any parameters, but you said =back 4
- Around line 314:
=back doesn't take any parameters, but you said =back 4