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 ] [ -W ] [ -L ] [ -V|--version
12       ] [ -- ] [ psfile1 ] [ psfile2 ] [ ... ]
13
14

DESCRIPTION

16       This manual page documents ps2eps version 1.64.
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       -L, --license
141              show licensing information.
142
143       -d, --debuggs
144              show ghostscript call. This may be helpful for solving  problems
145              that occur during a ghostscript call.
146
147       -W, --warnings
148              show  warnings about sanity of generated EPS file. Certain post‐
149              script commands should not be contained in an  EPS  file.   With
150              this  option  set  ps2eps  will issue a warning if it detects at
151              least one of them.
152

TROUBLESHOOTING

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

ENVIRONMENT VARIABLES

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

EXAMPLES

291       The usual call is simply: ps2eps -l file
292
293       A relatively failsafe call would be (if your postscript is smaller than
294       iso  b0 [100cm x 141.4cm] and you have a fast computer with enough mem‐
295       ory): ps2eps -l -B -s b0 -c -n file
296
297       If output is not correct try: ps2eps -l -B -s b0 -F file
298

AUTHOR

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

BUGS

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

SEE ALSO

340       bbox (1), gs (1), ps2epsi (1)
341
342
343
344                                24 Januar 2007                       PS2EPS(1)
Impressum