[Tex/LaTex] epspdfconversion problems in xelatex

epstopdfxetex

I am using xelatex and I am trying to use epspdfconversion package to on-the-fly remove unnecessary empty margins from my figures. The figures themselves are dynamically generated and calculating a tight bounding box via bbox option of epspdf seemed like a good idea.

Unfortunately, epspdfconversion does not seem to play nice with xelatex. Below is a minimum working example:

\documentclass{tufte-handout}

%\usepackage{xltxtra}
\usepackage{color}
\usepackage[bbox,pdftopdf=true,suffix=]{epspdfconversion}

\begin{document}
\includegraphics{unnamed-chunk-2.pdf}
\end{document}`

However, if uncomment \usepackage{xltxtra} and compile it xelatex I get the following message:

Package epstopdf Warning: Drivers other than `pdftex.def' are not supported.

epspdfconversion.sty is using epstopdf.sty with the following setup:
    update=true,
    verbose=true,
    prefersuffix=true,
    suffix=,
    option outdir not set. Default: same directory as the .eps-source-file
    append,
    enable
epspdf is used with the following command:
    epspdf --bbox <file> 
Package epspdfconversion Info: 
(epspdfconversion)             epspdf --bbox <file> is used to convert eps-pdf
(epspdfconversion)             (not epstopdf (script))
(epspdfconversion)              on input line 334.
! Undefined control sequence.
l.345 \epstopdfDeclareGraphicsRule
                                  {.eps}{pdf}{.pdf}{%
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

This seems to be a conflict between xelatex and epspdfconversion.sty I am using extra OTF fonts and using xelatex seems necessary. Does anyone have any recommendations for solving or bypassing this problem?

Best Answer

epstopdf works only with the pdftex driver for graphics, as the first warning tells you. However, lualatex can be used as well as pdflatex.