A while ago I asked how to Include Adobe Illustrator files (ai) with XeTeX. However, the PDF version of the Illustrator files is 1.5 and I compile my XeLateX documents to version 1.4 so the newer illustrator files can't be included without conversion.

I've now found that ps2pdf14 can take the illustrator ai file as an input and easily output a pdf 1.4 compatible version.

I've tried working the with DeclareGraphicsRule based on Convert gif image to png on the fly however, I can't seem to figure out a rule that works to run ps2pdf14?

I've tried these:

\DeclareGraphicsRule{.ai}{pdf}{.pdf}{`ps2pdf #1}
\DeclareGraphicsRule{.ai}{pdf}{.ai.pdf}{`ps2pdf #1}
\DeclareGraphicsRule{.ai}{pdf}{.pdf}{`ps2pdf14 #1 `dirname #1`/`basename #1 .ai`-ai-converted-to.pdf}
\DeclareGraphicsRule{.ai}{pdf}{.pdf}{ps2pdf14 \SourceFile.\SourceExt \OutputFile}

Here is an .ai file from the latest illustrator version (CS5) if anyone wants to play around: link removed

It would be ideal if the conversion was only done if the illustrator document has been modified after the converted pdf file or if the converted pdf file doesn't exist.

Maybe a make file or script of some kind would be a better solution.

2 Answers 2


I guess you can adapt this answer to your need:

\epstopdfDeclareGraphicsRule{.ai}{pdf}{.pdf}{ps2pdf14 #1 \OutputFile}


This will do the conversion only if example.ai file is newer than the converted file example-ai-converted-to.pdf (or this one does not exist).

It's necessary to call pdflatex with the command line option -shell-escape at least when the converted file does not exist.

  • Is there a way to use epstopdf with XeLaTeX?
    – s0rce
    Mar 11, 2012 at 20:50
  • Sorry, no. :( I really don't know why.
    – egreg
    Mar 11, 2012 at 20:56
  • One problem is that XeTeX lacks a command to get the modification date of a file.
    – egreg
    Mar 11, 2012 at 22:09

For now I made a simple batch script that does what I need but I would love a latex solution!

for /r %%x in (*.ai) do ps2pdf14 "%%x" converted\%%~nx.pdf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .