NAME

psfixbb - fix the BoundingBox in a Postscript file.


SYNOPSIS

psfixbb [-ceflr] [-x N] [-o outfile] filename [filename...]


DESCRIPTION

psfixbb is a tool to create a BoundingBox in Postscript(R) files which do not have one, or to fix an incorrect existing BoundingBox.

Many applications write Postscript(R) files or Encapsulated Postscript(R) files with no or incorrect BoundingBox information. I.e. the box which contains the image or text on the page is often smaller than specified in the %%BoundingBox comment in the file. This can be annoying when importing the file into other documents. psfixbb computes the size of the used part of a page and inserts the information into the file.

psfixbb uses ghostscript (gs) to transform the page into a portable bit map (pbm), then the pnmfile and pnmcrop utilities to determine the size of the non-white part of the page. These three programs need to be installed for psfixbb to work.

Because psfixbb really looks at the dark pixels of the page, it works even if the application which produced the Postscript file has painted the background of the whole page white. Most other boundingbox-fixing utilities choose the entire page in such cases. When the BoundingBox is smaller then the white background, it may be necessary to tell your text program to clip the image when importing it. For example, in LaTeX you need to specify ``clip='' as a parameter to the \includegraphics macro.

For landscape figures, it may or may not be necessary to rotate the page (using the -r switch) before attempting to compute the bounding box .


OPTIONS

-c
Send a new file with the correct BoundingBox to stdout. This will leave the original file untouched. Only the first filename on the command line will be processed.

-e
When the filename extension is .ps, change it to .eps (unless the resulting file name corresponds to an existing file). See also the -f flag.

-f
When specified together with the -e flag, existing .eps files are overwritten when necessary.

-l
List computed BoundingBoxes, do not change any files.

-o outfile
Output to file OUTFILE.

-r
Rotate the page for BoundingBox calculations. This may or may not be needed for landscape figures.

-x N
The BoundingBox created can be made larger than the actual image by N postscript points with this option.


AUTHOR

Carsten Dominik <dominik@strw.LeidenUniv.nl>

Holger Karl <karl@informatik.hu-berlin.de>

This program is free software. See the source file for the full copyright notice.


FILES

For the file file.ps, file.ps.bak is used as a temporary file.


SEE ALSO

gs(1), pnmfile(1), pnmcrop(1), pnm(5)


BUGS

psfixbb does not work for images larger than a normal page.

Rotation of landscape files should really be automatic, but I don't know a general way to determine if this is necessary of not. Suggestions are welcome.

The file file.ps.bak is overwritten without checking.

For multipage documents, only the first page determines the value of the BoundingBox.


ACKNOWLEDGMENTS

Thanks to Georg Drenkhahn for pointing out how to enforce a showpage command in gs.