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 ] [ -n ] [ -P ] [ -c ] [ -C ] [ -m ] [
10       -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.68.
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.
24
25       Without  any  argument,  ps2eps reads from standard input and writes to
26       standard output.  If filenames are given as  arguments  they  are  pro‐
27       cessed one by one and output files are written to filenames with exten‐
28       sion .eps. If input filenames have the  extension  .ps  or  .prn,  this
29       extension  is  replaced with .eps.  In all other cases .eps is appended
30       to the input filename.  Please note that  PostScript  files  for  input
31       should  contain only one single page (you can possibly use the psselect
32       from the psutils package to extract a single page from a document  that
33       contains multiple pages).
34
35       If  BoundingBox  in output seems to be wrong, please try options --size
36       or --ignoreBB. See also section TROUBLESHOOTING.
37

OPTIONS

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

TROUBLESHOOTING

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

ENVIRONMENT VARIABLES

285       Please note that a command line option always takes precedence over the
286       related environment variable.
287
288       The  environment  variable PS2EPS_SIZE can be used to specify a default
289       page size and take any argument that --size accepts.  Examples:  export
290       PS2EPS_SIZE=a0  (bash-like  syntax)  or  setenv PS2EPS_SIZE letter (csh
291       syntax).
292
293       If the environment variable PS2EPS_GSBBOX  is  set  the  internal  bbox
294       device  of  ghostscript  will  be  used instead of the external command
295       bbox. Examples: export PS2EPS_GSBBOX=true  (bash-like syntax) or setenv
296       PS2EPS_GSBBOX 1 (csh syntax).
297

EXAMPLES

299       The usual call is simply: ps2eps -l file
300
301       A relatively failsafe call would be (if your postscript is smaller than
302       iso b0 [100cm x 141.4cm] and you have a fast computer with enough  mem‐
303       ory): ps2eps -l -B -s b0 -c -n file
304
305       If output is not correct try: ps2eps -l -B -s b0 -F file
306

AUTHOR

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

BUGS

342       If you experience problems, please check carefully  all  hints  in  the
343       section  TROUBLESHOOTING first. Otherwise, check for an updated version
344       at  <URL:http://www.tm.uka.de/~bless/ps2eps> or send a gzipped file  of
345       relevant  postscript source code with your error description and ps2eps
346       version number to <roland at  bless.de>  (please  allow  some  time  to
347       reply).
348

SEE ALSO

350       bbox (1), gs (1), ps2epsi (1)
351
352
353
354                                31 August 2010                       PS2EPS(1)
Impressum