1PS2EPS(1)                                                            PS2EPS(1)
2
3
4

NAME

6       ps2eps - convert PostScript to EPS (Encapsulated PostScript) files
7

SYNOPSIS

9       ps2eps [ -f ] [ -q ] [ -N ] [ -O ] [ -X ] [ -n ] [ -P ] [ -c ] [ -C ] [
10       -m ] [ -B ] [ -E ] [ -s pagedim ] [ -t offset ] [ -r resolution ] [  -R
11       +|-|^  ] [ -l ] [ -g ] [ -H ] [ -d ] [ -h|--help ] [ -a ] [ -W ] [ -L ]
12       [ -V|--version ] [ -- ] [ psfile1 ] [ psfile2 ] [ ... ]
13
14

DESCRIPTION

16       This manual page documents ps2eps version 1.70.
17
18       ps2eps is a tool (written in Perl) to produce  Encapsulated  PostScript
19       Files  (EPS/EPSF)  from usual one-paged Postscript documents. It calcu‐
20       lates correct Bounding Boxes for those EPS files and filters some  spe‐
21       cial postscript command sequences that can produce erroneous results on
22       printers. EPS files are often needed for including (scalable)  graphics
23       of  high  quality into TeX/LaTeX (or even Word) documents.  It can also
24       be used to calculate correct BoundingBoxes for PDF files by  using  the
25       option  --BBonly.  However, it cannot produce a PDF file, but it can be
26       used together with pdfcrop.
27
28       Without any argument, ps2eps reads from standard input  and  writes  to
29       standard  output.   If  filenames  are given as arguments they are pro‐
30       cessed one by one and output files are written to filenames with exten‐
31       sion  .eps. If input filenames have the extension .ps or .prn, this ex‐
32       tension is replaced with .eps.  In all other cases .eps is appended  to
33       the input filename.  Please note that PostScript files for input should
34       contain only one single page (you can possibly use  the  psselect  from
35       the  psutils package to extract a single page from a document that con‐
36       tains multiple pages).
37
38       If BoundingBox in output seems to be wrong, please try  options  --size
39       or --ignoreBB. See also section TROUBLESHOOTING.
40

OPTIONS

42       ps2eps  follows  the  usual  GNU command line syntax, with long options
43       starting with two dashes (`-').  A summary of options is  included  be‐
44       low.
45
46       -h, --help
47              Show summary of options.
48
49       -V, --version
50              Show version of program.
51
52       -f, --force
53              Force  overwriting  existing  files.  ps2eps  will not overwrite
54              files by default to avoid  deleting  original  EPS  files  acci‐
55              dently.
56
57       -q, --quiet
58              quiet  operation  (no  output while processing files, except er‐
59              rors).
60
61       -N, --noinsert
62              do not insert any postscript code. Normally a few postscript in‐
63              structions  are  added  around  the  original postscript code by
64              ps2eps which can be turned off by this option.
65
66       -O, --preserveorientation
67              do not filter %%Orientation: header comment.
68
69       -X, --BBonly
70              Just print the resulting bounding box(es) to standard error,  no
71              output  file is written.  ps2eps will perform a read-only opera‐
72              tion. This is highly useful to calculate bounding boxes  of  PDF
73              files.  Can be used with option --quiet to suppress other output
74              and also with --nohires to suppress output of the HiResBounding‐
75              Box.   It  can  be used with pdfcrop as follows: pdfcrop --gscmd
76              'gswrap-ps2eps.sh'  file.pdf  where  gswrap-ps2eps.sh  containts
77              something like ps2eps -l -X -q $BASH_ARGV
78
79       -n, --nofix
80              do  not  try  to  fix postscript code by filtering some instruc‐
81              tions.
82
83       -P, --removepreview
84              remove preview image (smaller file, but no preview anymore).
85
86       -F, --fixps
87              fix postscript code  unconditionally.  Otherwise,  filtering  is
88              usually triggered by detection of certain drivers only.
89
90       -c, --comments
91              preserve document structure comments.
92
93       -C, --clip
94              insert  postscript code for clipping. Unless --nohires is speci‐
95              fied, the HiResBoundingBox (enlarged by 0.1 points) is used  for
96              clipping.
97
98       -m, --mono
99              use black/white bitmap as base for calculation (default: off).
100
101       -s, --size=pagedim
102              where  pagedim  is  a  pre-defined  standard  page  size  (e.g.,
103              a4,a0,b0,letter,...)  or  explicitly  specified  in   a   format
104              pagedim:=XxY[cm|in],  where X and Y are numbers (floating points
105              are accepted) followed by units centimeter (cm)  or  inch  (in),
106              (default:  cm).   Use --size=list to list pre-defined pagesizes.
107              See also environment variable PS2EPS_SIZE.
108
109       -t, --translate=x,y
110              specify an x,y offset (may be  negative)  in  postscript  points
111              (1/72  dpi)  for  drawing.  This  option may be required if your
112              drawing has negative coordinates which usually lets  ghostscript
113              cut the negative part of your picture, because it starts to ren‐
114              der at positive coordinates. The resulting output will  also  be
115              shifted.
116
117       -r, --resolution=dpi
118              specify  a  resolution  in dpi (dots per inch) for drawing under
119              ghostscript. Default resolution is 144 dpi which is  the  double
120              of the typical 72 dpi.  This option may help if there is a hard‐
121              ware dependent  resolution  encoded  in  the  postscript,  e.g.,
122              600dpi. Example: ps2eps -l -r 600 test.ps
123
124       -R, --rotate=direction
125              This option rotates the resulting EPS output.  The parameter di‐
126              rection determines the direction of rotation: +  means  +90  de‐
127              grees  (clockwise),-  means -90 degrees (counter-clockwise), and
128              ^ means 180 degrees (up-side down).
129
130       -l, --loose
131              expand the original tight bounding box by one point in each  di‐
132              rection.
133
134       -B, --ignoreBB
135              do not use existing bounding box as page size for rendering.
136
137       -E, --ignoreEOF
138              do  not use %%EOF as hint for end of file. Otherwise, ps2eps as‐
139              sumes that postscript code ends after the  last  %%EOF  comment,
140              because  some drivers add trailing binary ``garbage'' code which
141              gets deleted by ps2eps by default.
142
143       -g, --gsbbox
144              use internal bbox device of ghostscript instead of the  external
145              C  program  bbox. The internal bbox device of ghostscript gener‐
146              ates different values (sometimes even incorrect), so  using  the
147              provided bbox should be more robust.  See also environment vari‐
148              able PS2EPS_GSBBOX.
149
150       -H, --nohires
151              do not generate a %%HiResBoundingBox comment for output.
152
153       -a, --accuracy
154              increase the accuracy by turning subsample antialiasing on  (may
155              be slower)
156
157       -L, --license
158              show licensing information.
159
160       -d, --debuggs
161              show  ghostscript call. This may be helpful for solving problems
162              that occur during a ghostscript call.
163
164       -W, --warnings
165              show warnings about sanity of generated EPS file. Certain  post‐
166              script  commands  should  not be contained in an EPS file.  With
167              this option set ps2eps will issue a warning  if  it  detects  at
168              least one of them.
169

TROUBLESHOOTING

171       Based  on  the given postscript source code (in most cases generated by
172       some postscript printer driver) there are many potential  obstacles  or
173       problems  that may occur when trying to create proper EPS files. Please
174       read this section carefully to be aware of common pitfalls.
175
176   INCOMPLETE/CLIPPED IMAGES
177       or how to determine the right size for ghostscript.
178
179       If you have documents that are larger  than  your  ghostscript  default
180       (usually  A4 or US letter), you have to specify the page dimensions ex‐
181       plicitly using the -s option. Otherwise your EPS might be cut off  dur‐
182       ing rasterizing by ghostscript resulting in a wrongly calculated bound‐
183       ing box. You can pass all pre-defined page sizes to -s that ghostscript
184       understands.  These  are  currently: 11x17, ledger, legal, letter, let‐
185       tersmall, archA, archB, archC, archD, archE a0, a1, a2, a3, a4, a5, a6,
186       a7,  a8,  a9, a10, isob0, isob1, isob2, isob3, isob4, isob5, isob6, b0,
187       b1, b2, b3, b4, b5, c0, c1, c2, c3, c4, c5, c6,  jisb0,  jisb1,  jisb2,
188       jisb3, jisb4, jisb5, jisb6, flsa, flse, halfletter.  Unfortunately, all
189       sizes are currently only available in portrait orientation  (not  land‐
190       scape).
191
192       By  default, ps2eps uses an already given %%BoundingBox from the source
193       file, which often corresponds to the size of the physical  page  format
194       for  which  the document was printed. However, you should be aware that
195       this already specified bounding box may be not correct, thus  resulting
196       in a wrongly cropped (or even no usable) .eps-file.  ps2eps can only do
197       as good as ghostscript does in rendering the original  postscript  file
198       (though  ps2eps even works with negative and fractional values are con‐
199       tained in the original bounding box by  using  automatic  translation).
200       Therefore,  if  the given bounding box is to small or incorrect anyway,
201       you can ignore the existing bounding box with the -B option, which will
202       cause  ghostscript  to  use its internal default size (or use -s). How‐
203       ever, if the BoundingBox has negative coordinates, which is not allowed
204       by the specification, ps2eps will shift the output to positive values.
205
206       Hint: to avoid rotating the picture if you have the original drawing in
207       landscape format, you may use the ``Encapsulated Postscript'' option in
208       the printer driver which should generate an EPS file (but with a bound‐
209       ing box of the sheet size!). But some Windows printer drivers are draw‐
210       ing  the  image with an offset from the bottom of the portrait page, so
211       that a part of it is drawn outside the  landscape  oriented  page.   In
212       this  case,  you'll have to specify a square size of the page using the
213       maximum length, e.g., 29.7cm x 29.7cm for an A4 page.
214
215   CLIPPING
216       or why gets some of my text deleted above the included .eps file?
217
218       Some postscript drivers draw a white rectangle from the top left corner
219       of  the  page  to  the right lower corner of the object. This may erase
220       some or even all text above your imported/included EPS file,  which  is
221       very  annoying. In order to prevent this, most programs have a clipping
222       option for imported .eps files (within LaTeX you can use \includegraph‐
223       ics*{})  for  this  purpose. If this is unfortunately not the case, you
224       can use the -C option of ps2eps which will (hopefully) do it  for  you.
225       Unfortunately,  PScript.dll  5.2 (Windows XP) introduced new very badly
226       behaving Postscript code (initclip) which will even override the  outer
227       clipping!  Thus,  a new filter had to be installed in ps2eps which will
228       fix it.
229
230       However, because most programs clip directly on the bounding  box,  you
231       still  may loose some pixels of your image, because the bounding box is
232       described in the coarse resolution of postscript points, i.e.  72  dpi.
233       In  order  to prevent this, you can use the -l option or -C option (for
234       the latter, clipping by the importing program should be disabled  then)
235       to  allow for a 1 point larger bounding box.  -C clips around a 1 point
236       enlarged bounding box and -l enlarges the  bounding  box  values  by  1
237       point (you can also combine both options).
238
239   INCLUDED FILTERS
240       Some  postscript  sequences,  e.g., for using specific printer features
241       (featurebegin ...), are not working well within an .eps file, so ps2eps
242       tries  to  filter them out. But please note that filters for postscript
243       code may not work properly for your printer driver (ps2eps  was  mainly
244       tested  with HP and Adobe printer drivers, although it may work for all
245       printers using the PScript.dll). In this case you can try  to  turn  of
246       filtering  by  using  option -n, or try to find the bad sequence in the
247       postscript code and adapt the filter rule in the ps2eps  script  (vari‐
248       ables  $linefilter, $rangefilter_begin, $rangefilter_end; linefilter is
249       an expression for filtering single lines, rangefilter_...  are  expres‐
250       sions that filter all lines between a pattern matching $rangefilter_be‐
251       gin and $rangefilter_end; drop me an e-mail with  your  modifications).
252       However,  things  may change as the printer drivers (e.g., PScript.dll)
253       or postscript language evolve.
254
255       Some applications or drivers generate postscript code with  leading  or
256       trailing  binary  code,  which  often  confuses older postscript inter‐
257       preters. ps2eps tries to remove such code, but it may sometimes make  a
258       wrong guess about start and end of the real postscript code (drop me an
259       e-mail with a zipped postscript source, see section BUGS).
260
261       Comment lines or even blank lines are removed (which is the default  to
262       make  .eps  files smaller), which may corrupt your output. Please check
263       the next section how to fix this.  ps2eps removes blank lines and  also
264       <CR> (carriage ceturn ``\r'') at the end of lines. However, nicely for‐
265       matted postscript code gives a hint by using ``%%BeginBinary'' ``%%End‐
266       Binary''  comments.  When ps2eps detects these comments it will refrain
267       from any filtering action within the marked binary sections.
268
269       ps2eps filters also %%Orientation: comments by default (you can use op‐
270       tion  -O  to  turn  off filtering), because ghostscript may ``automagi‐
271       cally'' rotate images when generating PDF images, which is not  desired
272       in  most  cases. Hint: you can turn off that feature in ghostscript un‐
273       conditionally by specifying -dAutoRotatePages=/None.
274
275   CORRUPTED OUTPUT
276       Some postscript code may get corrupted when comment lines or even blank
277       lines  are  removed  (which is the default to make .eps files smaller),
278       because those files may contain encoded images which also have a  %  as
279       first  character in a line or use a special comment as end of image de‐
280       limiter. If this is the case, use the -c option  to  prevent  filtering
281       comments.
282
283   COLOR AND MEMORY
284       ps2eps  supports  colored  postscript, consequently letting ghostscript
285       consume more resources for drawing its bitmap (roughly 6MBytes  for  an
286       A4  page).  bbox is reading the bitmap line by line so it consumes only
287       minimal memory. If you experience problems with memory  consumption  of
288       ghostscript,  you  may  use the -m option for using a monochrome image.
289       But this will probably result in wrongly determined bounding boxes with
290       colored images, because ghostscript has to do black/white dithering and
291       may thus suppress objects drawn in light colors.
292
293       Another option in case of memory problems and too long run times is  to
294       use  the  much more memory efficient internal ghostscript bbox by using
295       the -g option.
296

ENVIRONMENT VARIABLES

298       Please note that a command line option always takes precedence over the
299       related environment variable.
300
301       The  environment  variable PS2EPS_SIZE can be used to specify a default
302       page size and take any argument that --size accepts.  Examples:  export
303       PS2EPS_SIZE=a0  (bash-like  syntax)  or  setenv PS2EPS_SIZE letter (csh
304       syntax).
305
306       If the environment variable PS2EPS_GSBBOX is set the internal bbox  de‐
307       vice  of ghostscript will be used instead of the external command bbox.
308       Examples:  export  PS2EPS_GSBBOX=true   (bash-like  syntax)  or  setenv
309       PS2EPS_GSBBOX 1 (csh syntax).
310

EXAMPLES

312       The usual call is simply: ps2eps -l file
313
314       A relatively failsafe call would be (if your postscript is smaller than
315       iso b0 [100cm x 141.4cm] and you have a fast computer with enough  mem‐
316       ory): ps2eps -l -B -s b0 -c -n file
317
318       If output is not correct try: ps2eps -l -B -s b0 -F file
319

AUTHOR

321       ps2eps was written by Roland Bless.
322
323   WHY?
324       Other  programs  like  ps2epsi do not calculate the bounding box always
325       correctly (because the values are put on the postscript stack which may
326       get  corrupted  by bad postscript code) or rounded it off so that clip‐
327       ping the EPS cut off some part of the image. ps2eps uses a double  pre‐
328       cision  resolution  of 144 dpi and appropriate rounding to get a proper
329       bounding box. The internal bbox device of ghostscript generates differ‐
330       ent  values  (sometimes  even  incorrect),  so  using the provided bbox
331       should be more robust.  However, because normal  clipping  has  only  a
332       resolution  of  1/72dpi  (postscript  point),  the clipping process may
333       still erase parts of your EPS image. In this case please use the -l op‐
334       tion  to add an additional point of white space around the tight bound‐
335       ing box.
336
337   ACKNOWLEDGMENTS
338       Some people contributed code or suggestions to improve ps2eps. Here are
339       at  least  some  names (sorry if I forgot your name): Christophe Druet,
340       Hans Ecke, Berend  Hasselman,  Erik  Joergensen,  Koji  Nakamaru,  Hans
341       Fredrik  Nordhaug,  Michael  Sharpe.   Special  thanks  goes to Michael
342       Sharpe from UCSD who suggested a lot of useful features for ps2eps  and
343       who fixed bbox to become more precise and robust.
344
345       An earlier version of this manual page was originally written by Rafael
346       Laboissiere <rafael at debian.org> for the  Debian  system.  Thank  you
347       Rafael!
348
349       Permission  is  granted to copy, distribute and/or modify this document
350       under the terms of the GNU Free Documentation License, Version  1.1  or
351       any  later  version  published by the Free Software Foundation; with no
352       Invariant Sections, no Front-Cover Texts and no Back-Cover Texts.
353

BUGS

355       If you experience problems, please check carefully  all  hints  in  the
356       section  TROUBLESHOOTING first. Otherwise, check for an updated version
357       at  <URL:http://www.tm.uka.de/~bless/ps2eps> or send a gzipped file  of
358       relevant  postscript source code with your error description and ps2eps
359       version number to <roland at bless.de> (please allow some time  to  re‐
360       ply).
361

SEE ALSO

363       bbox (1), gs (1), ps2epsi (1)
364
365
366
367                              September 1st, 2018                    PS2EPS(1)
Impressum