Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Adobe Illustrator files are PDF compatible. That is a regular PDF reader, ex. Sumatra-pdf, can open and view them. I was hoping it would be possible to have xetex (with xelatex) and graphicx to include Adobe Illustrator files directly without having to go into Illustrator and save as a PDF manually. This would simplify my workflow and make it much quicker to make changes to figures in Illustrator and then compile the xetex document to see how it looks in the text.

Does anyone know if this is possible?

What versions of PDF are supported (is this determined by the graphicx package)? Are there other PDF importing methods?

Edit: in the .log there isn't much information:

File: image.pdf Graphic file (type QTm)
 <use  "image.pdf" >

I renamed it to .pdf from .ai, otherwise it won't work at all, however, the image doesn't appear in the document.

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

share|improve this question
    
Can't reproduce. –  Martin Schröder Feb 10 '12 at 0:23

4 Answers 4

up vote 7 down vote accepted

While it may be possible to trick XeTeX into accepting .ai-files from Illustrator I would recommend against it. The in the .ai-file embedded pdf document is using a higher pdf version than the standard version of pdfTeX in most distributions but you can adjust this using \pdfminoversion. Additionally the file is much larger and I am not sure if XeTeX would be able to throw out the unnecessary parts, so that your final document would also wasting lots of space.

Exporting it from Illustrator as a PDF/X files has worked nicely for me with many documents and helps you to achieve a final document which is close to PDF/X and won't give you any troubles with printing or different readers.

share|improve this answer
2  
Couldn't you just compile against a newer version of PDF then? I know aiming at old versions increase compatibility, but 1.5 came out in 2003. Won't everyone want to move to 1.7 (allows OpenType font embedding) at some point anyway? –  Canageek Jan 20 '12 at 18:58
    
@Canageek: What do you mean by "compiling against a newer version of PDF"? As far as I know pdf-/Xe-/LuaTeX need to understand the embedded pdf file to some degree and do not insert it as a binary blob but I did not find any more information easily. –  Alexander Jan 20 '12 at 19:37
2  
PDFTeX defaults to v1.5 of the PDF standard. You can however change this to a higher version via \pdfminorversion according to the PDFTeX manual. It uses 1.5 as a balance between compatibility and features (1.5 adds object compression) –  Canageek Jan 20 '12 at 19:39
    
Sorry, this is bogus. pdfTeX and LuaTeX can include any version of PDF. The complain you get is probably caused by not using \pdfminorversion. –  Martin Schröder Feb 10 '12 at 0:20
    
@MartinSchröder: Thanks for the notice. I changed the comment accordingly. –  Alexander Feb 10 '12 at 10:35

Just try the following lines. It tells Latex to treat files with .ai extensions like pdf files. My ai file calendar.ai was created with Adobe Illustrator CS3 and is PDF-1.5.

Update: I did a mistake. I tested it with pdflatex and lualatex not with xelatex. With xelatex it doesn't work.

\documentclass{book}
\usepackage{graphicx}

\DeclareGraphicsRule{.ai}{pdf}{.ai}{}

\begin{document}
\begin{figure}
\includegraphics{calendar.ai}
\end{figure}
\end{document} 
share|improve this answer
    
Could you (or the OP) post a link to a file that we can use to test this out? –  Joseph Wright Jan 20 '12 at 17:29
    
Here is a ai file from the latest Illustrator CS5. dl.dropbox.com/u/3730003/example.ai –  s0rce Jan 21 '12 at 3:35
    
I tested it with the example.ai with the same results: pdflatex and lualatex works, xelatex doesn't work. But if I rename the extension from .ai to .pdf xetex works fine. Example.ai was created by Illustrator CS5 but is PDF-1.5 too. –  Holle Jan 22 '12 at 22:10
    
"Doesn't work" is no usable error message. Please be more precise. Does the computer explode? –  Martin Schröder Feb 10 '12 at 9:05

I would try to use inkscape to convert ai to pdf -- something like this:

inkscape --export-pdf=file.pdf file.ai

If it'd succeed (it should, but "it may depend"), I would try to write a graphics rule, see here, for example: Convert gif image to png on the fly.

Hope this helps.

share|improve this answer

With the example file provided by s0rce, I get the same result in pdfLaTeX, LuaLaTeX and XeLaTeX by doing the following trick:

\documentclass[a4paper]{book}
\usepackage{graphicx}
\usepackage{ifxetex}

\ifxetex
  \DeclareGraphicsRule{.ai}{QTm}{QTm}{#1}
\else
  \DeclareGraphicsRule{.ai}{pdf}{.ai}{}
\fi

\begin{document}
\begin{figure}
\includegraphics{example.ai}
\end{figure}
\end{document}

Note. The line \DeclareGraphicsRule{.ai}{QTm}{QTm}{#1} has been kindly suggested by David Carlisle instead of the more complicated

\makeatletter
\@namedef{Gin@rule@.ai}#1{{QTm}{QTm}{#1}}
\makeatother
share|improve this answer
1  
why the \@namedef rather than \DeclareGraphicsRule{.ai}{QTm}{QTm}{#1} ? –  David Carlisle Feb 10 '12 at 12:08
    
Just because I copied directly from xetex.def –  egreg Feb 10 '12 at 12:09
    
@egreg Your trick doesn't work for me. If I compile with XeLaTeX I get the error message "Unable to load picture or PDF file 'example.ai'". With pdfLaTeX and LuaLaTeX it works fine. I use the XeTeX version 3.1415926-2.3-0.9997.5 (MiKTeX 2.9). What is wrong with my XeLaTeX? –  Holle Feb 10 '12 at 13:57
    
Sorry, I don't know. Might be a problem with the QuickTime libraries; I ran the file on Mac OS X. –  egreg Feb 10 '12 at 13:59
    
I guess this requires quicktime. Is there some F/OSS alternative? –  s0rce Feb 12 '12 at 3:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.