\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}
When I try to compile the .tex file using pdflatex I get the following
sequence of errors:
Error: May not be a PDF file (continuing anyway)
Error (0): PDF file is damaged - attempting to reconstruct xref
table...
Error: Couldn't find trailer dictionary
Error: Couldn't find xref table
Error: pdflatex (file fig1.pdf): xpdf: reading PDF image failed
pdflatex converts fig1 ok, but that's it. I'm obviously missing
something, but I don't know what it is. Would someone please provide
some assistance or point me to the relevant documentation. Thanks very
much.
Richard
> I'm new to pdflatex and epstopdf and I'm having a little trouble. I
> use MikTeX 2.1 and WinEDT on Windows 2000. There are \includegraphics
> declarations in my .tex document. The graphics are eps files named
> fig1.eps, fig2.eps, and fig3.eps (original, I know). I'm trying to
> use epstopdf to do the graphics conversion. In the preamble I have:
>
> \usepackage[pdftex]{graphicx}
> \usepackage{epstopdf}
epstopdf is a _program_ not a package :-)
Use it to convert your .eps files to .pdf files, before pdflatex-ing
them. Don't use file extensions in the \includegraphics:
\includegraphics{myfile}
will use myfile.eps when you convert to PostScript, and myfile.pdf
when you use pdflatex to get a PDF. (The latter also accepts .png and
.jpeg.)
Herman
Hello,
that's not correct. There also exist a package epstopdf written by Heiko
Oberdiek to provide automated conversion from eps to pdf during a run of
pdftex. It uses the \write18-feature of TeX so that must be enabled to use
the package.
Jens Heise
% Function: This packages adds support of handling eps images
% to package graphic{s,x} with option `pdftex'.
% If an eps image is detected, epstopdf is automatically
% called to convert it to pdf format.
%
% Required: * The program `epstopdf'.
% * The feature `\write18' has to be enabled to get
% the conversion via the program epstopdf work:
% * command line option: -shell-escape
% example: pdflatex -shell-escape test.tex
% * configuraton file `texmf.cnf': shell_escape = 1
%
% Use: The package is loaded after graphic{s,x}, eg:
% \usepackage[pdftex]{graphicx}
% \usepackage{epstopdf}
So my original request for help stands. Thanks again for any
assistance.
Richard
for file in *.eps
do
epstopdf $file $(file%eps}.pdf
done
Run this once before you start, and then you can omit the epstopdf
package and not have to make repeated runs through your document.
There will be no repeated runs with the epstopdf package,
if the extension is omitted. A Makefile would make more
sense, because then epstopdf will only called if necessary.
Yours sincerely
Heiko <ober...@uni-freiburg.de>
True, except that then he has to maintain the makefile by keeping a
complete list of all the source files.
--
To reply by e-mail, change "deadspam.com" to "zzapp.org"
I've tested this under MiKTeX 2.1 on Win95 with a simple .tex
file and simple .eps files and all worked. These messages
appear to indicate that the .pdf file is incorrect. Your later
message (that multiple runs eventually produced correct figures
but it took as many runs as the number of figures) suggests that
the .eps files are OK and that epstopdf (the programs) is able
to correctly process them (one at a time). It seems to me this
leaves the program calls as the culprit.
There is a known problem with nested program calls in in Win2k.
One method of doing system calls (viz. the one used by djgpp)
always fails if such calls are nested. The problem is allegedly
a bug in system .dlls. In your example, you have WinEdt calling
pdflatex.exe calling epstopdf.exe calling gswin32c.exe. It is
entirely possible the first call to gs succeeds but the second
aborts with a partially completed .pdf file.
You should check the following: can you simply run pdflatex on
your source file (in a DOS window, outside of WinEdt)? Can you
simply run epstopdf on the .eps files? You should probably also
show the newsgroup a small example file that fails to work, so
we don't speculate ourselves to death.
Other possible sources of problems: Do you have more than one
epstopdf around? What version of GS is installed?
Dan Luecking
> > A Makefile would make more
> > sense, because then epstopdf will only called if necessary.
>
> True, except that then he has to maintain the makefile by keeping a
> complete list of all the source files.
With GNU make this is possible with few lines in the Makefile:
# collect all .eps files in current directory:
images := $(wildcard *.eps)
# replace ".eps" file extension with ".pdf":
images := $(patsubst %.eps,%.pdf,$(images))
# implicite rule that calls epstopdf:
%.pdf : %.eps
epstopdf $<
# main rule for the project, for example:
all: test.tex $(images)
pdfelatex $<
Yours sincerely
Heiko <ober...@uni-freiburg.de>