Hlavní navigace

a2ping

NAME

a2ping.pl -- convert between PS, EPS and PDF and other page description formats

SYNOPSIS

a2ping.pl [--]help a2ping.pl [--]doc a2ping.pl [options] <inputfile> [[outformat:] outputfile]

DESCRIPTION

a2ping is a \s-1UNIX\s0 command line utility written in Perl that converts many raster image and vector graphics formats to \s-1EPS\s0 or \s-1PDF\s0 and other page description formats. Accepted input file formats are: \s-1PS\s0 (PostScript), \s-1EPS\s0, \s-1PDF\s0, \s-1PNG\s0, \s-1JPEG\s0, \s-1TIFF\s0, \s-1PNM\s0, \s-1BMP\s0, \s-1GIF\s0, \s-1LBM\s0, \s-1XPM\s0, \s-1PCX\s0, \s-1TGA\s0. Accepted output formats are: \s-1EPS\s0, \s-1PCL5\s0, \s-1PDF\s0, \s-1PDF1\s0, \s-1PBM\s0, \s-1PGM\s0, \s-1PPM\s0, \s-1PS\s0, markedEPS, markedPS, \s-1PNG\s0, \s-1XWD\s0, \s-1BMP\s0, \s-1TIFF\s0, \s-1JPEG\s0, \s-1GIF\s0, \s-1XPM\s0. a2ping delegates the low-level work to Ghostscript (\s-1GS\s0), pdftops and sam2p. a2ping fixes many glitches during the \s-1EPS\s0 to \s-1EPS\s0 conversion, so its output is often more compatible and better embeddable than its input.
Without the CW--below option, it is guarenteed to start at the 0,0 coordinate. CW--below, CW--hires and CW-v are recommended options.
The page size is set exactly corresponding to the BoundingBox. This means that when Ghostscript renders it, the result needs no cropping, and the \s-1PDF\s0 MediaBox is correct.
If the bounding box is not right, of course, you have problems. If you feed crap in, you get crap. But you can supply the --bboxfrom=compute-gs option to make \s-1GS\s0 recompute the bounding box.
The name of the input file doesn't matter a2ping detects the file format based on the first few bytes of the file. The name of the output file matters if outformat is missing from the command line: then the extension of the output file determines the FileFormat (outformat).

EXTERNAL PROGRAMS

The internal file format of a2ping.pl is \s-1PS/EPS\s0. Everything read is first converted to \s-1PS\s0 or \s-1EPS\s0, then processed by a2ping.pl, then converted to the output format.
To analyse the bounding box and other properties of non-EPS \s-1PS\s0 files (and \s-1EPS\s0 files with option --bboxfrom other than =guess), \s-1GS\s0 is used. Converting \s-1PS\s0 to \s-1EPS\s0 involves this analysis.
To write \s-1PDF\s0 files, \s-1GS\s0 is used.
To read \s-1PDF\s0 files, pdftops from the xpdf package is used.
Sampled input formats are \s-1PNG\s0, \s-1JPEG\s0, \s-1TIFF\s0, \s-1PNM\s0, \s-1BMP\s0, \s-1GIF\s0, \s-1LBM\s0, \s-1XPM\s0, \s-1PCX\s0 and \s-1TGA\s0. To read sampled input formats, sam2p is used. sam2p is a raster image converter written in by the author of a2ping.pl.
Extra output formats are \s-1PNG\s0, \s-1XWD\s0, \s-1BMP\s0, \s-1TIFF\s0, \s-1JPEG\s0, \s-1GIF\s0 and \s-1XPM\s0. To write extra output formats, sam2p and \s-1GS\s0 are used.
\s-1PNM\s0 output formats are \s-1PGM\s0, \s-1PGM\s0 and \s-1PPM\s0. To write \s-1PNM\s0 output formats, \s-1GS\s0 is used.

TIPS AND TRICKS

"" Call with the -v option to see progress and debug messages.
"" If your \s-1EPS\s0 contains a wrong bounding box, you can fix it by running CWa2ping.pl -v --bboxfrom=compute-gs thefile.eps --
"" You can specify - as inputfile to get stdin and as outputfile to get stdout. This works even for \s-1PDF\s0 files (which must be seekable), because a2ping copies them to a temporary file automatically.
"" If inputfile and outputfile are the same, a2ping copies the inputfile to a temporary location first. However, this usage is recommended only if there is a backup of the file to be restored in case a2ping doesn't produce the desired result.
"" If you specify -- as outputfile, it will be the same as inputfile.
"" a2ping respects --Duplex for FileFormat \s-1PCL5\s0, even though \s-1GS\s0 doesn't.
"" If you have an incompatible \s-1PS\s0 that \s-1GS\s0 can read but your printer cannot print, just run CWa2ping.pl foo.ps PDF: - | a2ping.pl - PS: foo.ps
"" If you have a \s-1PS\s0 coming from Win32 (often with extension CW.prn), run it through a2ping. It will remove the resolution changes and the progress text printed to the terminal (which confuses gv(1) and makes some filters in the print queue emit incorrect output).
"" a2ping does antialiasing (--antialias=scale3no) of glyphs and curves when emitting a sampled image (FileFormats such as \s-1PGM\s0 and \s-1PPM\s0). This improves readability of the glyphs. =yes instructs \s-1GS\s0 to do internal antialiasing, but it usually doesn't improve much. =scale3no turns off \s-1GS\s0 internal antialiasing, but makes it render everything 3x3 as big, and then scales it back down. =scale3no turns on both 3x3 scaling and \s-1GS\s0 internal antialiasing, which results in thicker lines and worse quality in general.
"" When creating a \s-1PBM\s0 file, antialiasing usually doesn't improve the quality, so it is switched off by default. But if you set --antialias=scale3no or --antialias=scale3yes, \s-1GS\s0 will render a \s-1PGM\s0 file, and the value of --threshold determines the minimum intensity for white in the final \s-1PBM\s0.
"" If you need a bigger sampled output file, specify a larger --Resolution. The default is --Resolution=72. If your sampled output file is going to be really big, you should specify --AntiAlias=yes instead of the default --AntiAlias=scale3no to speed up conversion.

MISC

"" Doesn't depend on the filename or extension of the input file.
"" Conversion from \s-1EPS\s0 to \s-1PDF:\s0 fixes glitches etc., calls gs -sDEVICE=pdfwrite
"" Conversion from \s-1EPS\s0 to \s-1EPS:\s0 fixes various glitches, moves (llx,lly) to (0,0), removes binary junk from the beginning of the \s-1EPS\s0 etc.
"" Conversion from \s-1PDF\s0 to \s-1PDF:\s0 keeps the file intact
"" Conversion from \s-1PDF\s0 to \s-1EPS:\s0 calls pdftops -eps (of the xpdf package)
"" Conversion from \s-1PS\s0 to \s-1EPS:\s0 keeps 1st page only, removes setpagedevice etc.

AUTHORS

The author of a2ping is Szab['o] P['e]ter <pts@fazekas.hu>.
a2ping is inspired by and historically based on the epstopdf Perl script modified by Thomas Esser, Sept. 1998, but his modifications have been removed from a2ping, and also a2ping and epstopdf do not share common code anymore. epstopdf is written by Sebastian Rahtz, for Elsevier Science. epstopdf contained extra tricks from Hans Hagen's texutil.

HISTORY

1999/05/06 v2.5 (Heiko Oberdiek)

* New options: --hires, --exact, --filter, --help. * Many cosmetics: title, usage, ... * New code for debug, warning, error * Detecting of cygwin perl * Scanning for %%{Hires,Exact,}BoundingBox. * Scanning only the header in order not to get a wrong BoundingBox of an included file. * (atend) supported. * uses strict; (earlier error detecting). * changed first comment from '%!PS' to '%!'; * corrected (atend) pattern: '\s*\(atend\)' * using of $bbxpat in all BoundingBox cases, correct the first white space to '...Box:\s*$bb...' * corrected first line (one line instead of two before 'if 0;';

2000/11/05 v2.6 (Heiko Oberdiek)

* %%HiresBoundingBox corrected to %%HiResBoundingBox

2001/03/05 v2.7 (Heiko Oberdiek)

* Newline before grestore for the case that there is no whitespace at the end of the eps file.

2003/02/02 (Szab['o] P['e]ter)

* option --below * removes DOS EPSF binary junk correctly * adds all 3 BoundingBox DSC comments * reads all 3 BoundingBox DSC comments, and picks the best * forces BoundingBox to be an integer * adds %%EndComments and proper %!PS-Adobe-?-? EPSF-?.? header * adds %%Pages: * adds invocation syntax: a2ping <infile.eps> <outfile.eps|pdf> * can convert PDF to EPS (by calling pdftops(1)) and PDF to PDF * emulates work for PDF input

2003/04/16 (Szab['o] P['e]ter)

* added PS and sam2p support, renamed to a2ping * sam2p and pdftops if $InputFilename eq '-'; * remove PJL UEL header from the beginning * works for PS non-EPS files for input * input support for PNG JPEG TIFF PNM BMP GIF LBM XPM PCX TGA via sam2p * removes ^L (form feed) from end of EPS file * -x=-c:rle to add sam2p options

2003/04/26 (Szab['o] P['e]ter)

* omit the unnecessary setpagedevice calls when creating normal eps * --noverbose --nocompress supported differently * no more option defaults :-( * justlib2 * multi-page output with PS:, PDF:, PCL5: * after `a2ping -pa4', file out.pcl says: `HP PCL printer data - A4 page size', instead of `US letter' * justlib2-ified doesn't depend on Getopt::Long anymore * fully supports filtering (stdin and/or stdout), PDF and PCL5 output to pipe (!$$ll_zero) * adds DSC ``%%DocumentMedia: plain 612 792 0 () ()'' * BoundingBox precedence for EPS input: --PageSize, %%*BoundingBox, setpagedevice. Precedence for other inputs: --PageSize, setpagedevice, %%*BoundingBox

2003/09/25 (Szab['o] P['e]ter)

* --bboxfrom=adsc: %%BoundingBox overrides -sDEVICE=bbox * improved bbox discovery * many bugfixes * MetaPost EPS input fixes for prologues:=0; * a2ping.pl -v --papersize=50,60 --bboxfrom=compute-gs t.ps t2.ps * consistent bbox, --PageSize, /PageSize handling * consistent --Resolution and --Duplex handling

2003/12/02 (Szab['o] P['e]ter)

* --bboxfrom=compute-gs option to fix PS -> EPS bbox (gs -sDEVICE=bbox), tuzv.eps

2004/02/10 v2.77 (Szab['o] P['e]ter)

* the compute-pipe routine is now run unless --bboxfrom=guess with EPS * added --gsextra= * added --antialias= * added FileFormat PBM, PGM, PPM * separated FileFormat features to FL_* constants * added --doc * there is no default FileFormat (PDF) anymore