1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
|
Epspdf and epsdftk
1 Usage
1.1 Overview
1.2 Viewing
1.3 Conversion options
1.4 Converting
1.5 The configuration screen
1.5.1 Configuring viewers
1.5.2 Options for converting to pdf
1.5.3 Options for converting to PostScript
2 Command-line usage
2.1 Option summary
3 Notes on PostScript and pdf
3.1 Bitmapped and vector
3.2 Font embedding
3.3 Eps preview headers
3.4 Bounding- and other boxes
3.5 Orientation
3.6 Exporting PostScript or pdf from Windows programs
4 Bitmapped graphics for LaTeX and pdflatex
4.1 Linux
4.2 Mac OS X
4.3 Windows
5 Troubleshooting
5.1 No options for output format visible
5.2 Ghostscript stackunderflow error
5.3 Part of the graphic gets cut off
5.4 Fonts look ugly
5.5 The page has been converted to a bitmap
5.6 Temporary files are not removed
5.7 Resources for troubleshooting
6 Change history
6.1 Version 0.6
6.2 Version 0.5
6.3 Version 0.4
Epspdf and epsdftk
******************
This manual is for epspdf, version 0.6.2.
Copyright (C) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep
Kroonenberg.
Copying and distribution of this file, with or without
modification, are permitted in any medium without royalty provided
the copyright notice and this notice are preserved. This file is
offered as-is, without any warranty.
1 Usage
*******
1.1 Overview
============
Epspdftk converts files between eps, pdf and general PostScript. The
main screen lets you open a file, select some options and convert the
file.
When opening a file, epspdf tries to find out file type and, in the case
of a pdf file, the number of pages. This information is displayed in
the box in the upper part of the screen.
1.2 Viewing
===========
The View button at the bottom of the screen calls an external viewer.
Windows and OS X: Epspdftk simply tries to use the default Open command.
Under Linux the PostScript- and pdf viewers are configurable; see *note
The configuration screen::.
The View button is grayed if epspdf thinks that there is no previewer
for the current file.
1.3 Conversion options
======================
Grayscaling: Grayscaling is now done by Ghostscript itself and should
"just work".
Compute tight boundingbox: This option is only available if a single
page is converted.
Page selection: The only possibilities are selecting a single page or
selecting all pages. Converting to eps implies selecting a single page.
For general PostScript files, there is no quick way to determine the
number of pages, so the program may not check beforehand whether you
picked an existing page. If you don't like that, convert the entire
document to pdf first - which will be done behind the scenes anyhow.
Specifying options such as grayscaling or page selection may require a
multistep conversion.
1.4 Converting
==============
The Convert and save... button calls up a file save dialog. After a
successful conversion, the result becomes the new current file, so you
can judge the result by pressing the View button again.
1.5 The configuration screen
============================
Epspdftk also has a configuration screen. The settings here are
preserved between sessions.
1.5.1 Configuring viewers
-------------------------
Under Unix, the preferred PostScript- and pdf viewers can be configured
in this screen. Epspdf looks for a number of PostScript- and pdf
viewers, from which you can select one, but you can also enter one
manually.
For Windows and Mac OS X, there is no such configuration option. Epspdf
will use the program associated with the file type, which can be
configured outside epspdf.
1.5.2 Options for converting to pdf
-----------------------------------
Double-check the setting "Target use" under "Conversion to pdf".
"prepress" is for pdfs which are going to be printed commercially. The
options prepress, printer and default will try to embed all fonts.
Often, printshops insist on this. With luck, Ghostscript fonts and
system fonts will be used for fonts which were not originally embedded.
Note that "printer" may not work with some versions of Ghostscript, due
to a bug in the handling of color.
On the other hand, you may prefer "screen" if file size is a concern.
See also the Ghostscript documentation, in particular Use.htm and
Ps2pdf.htm.
Specifying anything other than "default" may cause an additional
conversion step and possibly also loss of high-level structure.
As to pdf versions: this is a trade-off between more features for higher
versions and better compatibility for lower versions - although even
version 1.4 is far from bleeding-edge. Converting to a lower version
may lead to rasterization of vector data and (much) larger file sizes.
For prepress use, the printshop or publisher may require a low version
number but otherwise leave this at "default".
1.5.3 Options for converting to PostScript
------------------------------------------
For conversion the other way you may opt not to use pdftops even if it
is available. In this case, the conversion will be done by Ghostscript.
With older Ghostscript versions, characters may be converted to drawn
shapes or little bitmaps, so use pdftops if available. With newer
Ghostscript versions, with an eps2write rather than an epswrite output
device, Ghostscript does a much better job.
Under MikTeX, this is also the place to point the program to the
location of pdftops.exe.
2 Command-line usage
********************
epspdf.tlu is the backend of epspdftk, but it can also be used
standalone. It shares configuration settings with epspdftk.tcl.
The first parameter of the epspdftk GUI program is interpreted as
startup directory for the file browser. Epspdf itself has a more
elaborate command-line interface.
Below, we assume that there is a suitable wrapper or symlink for epspdf
on your searchpath. This is the case if you installed epspdf as a TeX
Live package.
Basic usage of epspdf itself:
epspdf [OPTIONS] INFILE [OUTFILE]
2.1 Option summary
==================
Typing 'epspdf --help' gives you the following summary:
$ epspdf --help
Epspdf version 0.6.2
Copyright (c) 2006, 2008, 2009, 2010, 2011, 2013, 2014, 2015 Siep Kroonenberg
Convert between [e]ps and pdf formats
Usage: epspdf[.tlu] [options] infile [outfile]
Default for outfile is file.pdf if infile is file.eps or file.ps
Default for outfile is file.eps if infile is file.pdf
-p, --page, --pagenumber PNUM
Page number; must be a positive integer
-g, --grey, --gray, -G, --GREY, --GRAY
Convert to grayscale
-b, --bbox, --BoundingBox
Compute tight boundingbox
-T, --target TARGET
One of screen, ebook, printer, prepress or default
-N, --pdfversion VERSION
One of 1.2, 1.3, 1.4 or default
-U Use pdftops if available
-I Reverses the above
-s, --save Save some settings to configuration file
-i, --info Info: display detected filetype and exit
-d Debug: do not remove temp files
-v, --version
Display version info and exit
-h, --help Display this help message and exit
3 Notes on PostScript and pdf
*****************************
3.1 Bitmapped and vector
========================
Pictures can be described either in terms of pixels, or more abstractly,
in terms of geometric shapes, fonts and text.
Bitmapped or pixel-based graphics are appropriate for photographs and
screenshots, but less so for diagrams and spreadsheet-generated
graphics.
A file in PostScript- or pdf format can contain both types of graphic
data.
Vector graphics can be freely scaled without losing sharpness or
becoming pixellated. If bitmapped graphics are enlarged too much,
individual pixels become apparent. With low-resolution bitmaps this
happens sooner than with high-resolution bitmaps, but high-resolution
bitmaps have (much) larger file sizes, and take longer to process.
So avoid converting vector to bitmap. However, converting from bitmap
to vector is also best avoided, since it is very hard to do well.
Epspdf normally avoids conversion from vector to bitmap and never
converts the other way. With the screen- and ebook "Target use" option,
included bitmaps tend to be downsampled, i.e. reduced to a lower
resolution.
3.2 Font embedding
==================
When converting to pdf, Ghostscript handles font embedding differently
depending on the "Target use" option. According to the Ghostscript
documentation, it embeds all fonts without exception for prepress- and
printer settings. Epspdf enforces this also for default settings. For
screen- and ebook settings, standard fonts such as Times may be omitted.
3.3 Eps preview headers
=======================
Preview headers are quietly stripped from eps files. These preview
headers are used by e.g. desktop-publishing software to represent eps
files on screen without having to interpret the PostScript code itself.
Epspdf currently has no option to preserve or add them.
3.4 Bounding- and other boxes
=============================
A PostScript file may have a page size and a boundingbox defined. A pdf
file may have a mediabox, a trimbox and various other boxes.
Ghostscript by itself normally converts the PostScript page - which is
anchored at (0,0) - to the pdf mediabox.
Conversion from eps to pdf usually translates the bottom-left corner to
the (0,0) origin and sets the page to the size of the graphic. Anything
outside the boundingbox should be cut off.
I have seen Illustrator-generated pdf files with negative coordinates
for the lower-left corner. However, this does not seem to cause
problems.
3.5 Orientation
===============
There appears to be no reliable way to set orientation for PostScript-
and pdf files. This may result part of a graphic being cut off after
conversion or even everything falling outside the page / mediabox /
boundingbox.
3.6 Exporting PostScript or pdf from Windows programs
=====================================================
Microsoft Office 2010 can now export to pdf, either the entire document
or a selection. This removes a major headache for Windows users.
As a last resort, you can "print" to a PostScript file. From some
programs, you can print a selection. A suitable driver which comes with
Windows is Generic / MS Publisher Color Printer. Pay attention to the
printer properties: choose "Outline" for font downloading and avoid the
"Optimize for speed" setting for PostScript Output Option. In my tests,
"Encapsulated PostScript" did not look very promising either. Try e.g.
"Archive" instead. These options can be found under the Advanced
button.
4 Bitmapped graphics for LaTeX and pdflatex
*******************************************
pdflatex can use graphics in .png format (best for screenshots) and .jpg
format (best for photographs) directly. However, for LaTeX you are
stuck with .eps format. Tips for converting to .eps:
4.1 Linux
=========
_sam2p_
This command-line bitmap-to-PostScript/pdf conversion utility is
available from <http://code.google.com/p/sam2p/> and may already be
packaged for your distribution. It produces very small files:
'sam2p image.png image.eps'
_ImageMagick/convert_
'convert' from the ImageMagick package is a command-line utility:
'convert image.png image.eps'
_The GIMP_
This is the premier open source image editing program. It is often
pre-installed on Linux, and is also available for other platforms.
The GIMP can save in eps- and pdf format.
4.2 Mac OS X
============
Mac OS X's built-in Preview application can read most bitmapped formats
and save them as pdf or PostScript. In fact, in many cases it is an
excellent alternative to epspdf.
4.3 Windows
===========
Windows is not a particularly friendly environment for PostScript or
pdf. A couple of command-line utilities try to fill the gap, _e.g._
sam2p image.png image.eps
or
bmeps -c image.png image.eps
sam2p is distributed with TeX Live (Windows only), bmeps both with TeX
Live and with MikTeX. Without the '-c' option, bmeps produces a
grayscale image. It produces larger files than sam2p.
With TeX Live, you can convert to eps by right-clicking an image in
Windows Explorer and "open" with _bitmap2eps_, which uses sam2p or bmeps
in the background.
5 Troubleshooting
*****************
5.1 No options for output format visible
========================================
Widen the window, to make the output format radio buttons visible.
5.2 Ghostscript stackunderflow error
====================================
Some Ghostscript versions, _e.g._ 9.10, have an error in color handling
when converting to pdf: selecting "printer" as target may lead to an
error 'stackunderflow in .setdistillerparams'. If you run into this,
use the "default" or "prepress" target instead.
5.3 Part of the graphic gets cut off
====================================
If the PostScript file was generated with the Windows PostScript driver,
experiment with the PostScript Output option. Don't choose Optimize for
Speed.
5.4 Fonts look ugly
===================
If Ghostscript has to do the conversion from pdf to ps then text may not
remain text, but may be replaced by bitmaps. Newer Ghostscript versions
tend to do better in this respect than older ones, but as to preserving
fonts, the pdftops utility may still handle more cases. It is part of
the xpdf suite and of the Poppler utilities.
5.5 The page has been converted to a bitmap
===========================================
This may happen if the page contains features such as transparency which
are not supported by intermediate formats.
Set pdf target use and target version both to "default" to avoid
unnecessary conversions: '-T default -N default'
5.6 Temporary files are not removed
===================================
* Command-line: make sure that you did not specify the option '-d'.
* Epspdftk GUI: make sure that 'Remove temp files' is checked.
* Windows: this platform is notorious for excessive file locking. I
already inserted a Windows-specific delay before attempting to
delete the temporary files, but this is not always enough.
However, you should have no trouble removing temporary files
manually.
5.7 Resources for troubleshooting
=================================
Logfile. The GUI has a button for viewing log output. This same output
is also written to a file 'epspdf.log'. For Linux/Unix/Mac OS X this is
in a subdirectory .epspdf of your home directory; for Windows it is in a
subdirectory epspdf of '%APPDATA%'. This APPDATA directory may be
'c:\Documents and Settings\YOUR USER NAME\Application Data' or
'c:\Users\YOUR USER NAME\AppData\Roaming'. Type 'echo %APPDATA%' to
find out which.
|