[XeTeX] pdfpages and XeTeX

Bruno Voisin bvoisin at mac.com
Fri Sep 8 00:01:40 CEST 2006

Le 7 sept. 06 à 22:01, Pablo Rodríguez a écrit :

> I have to insert a 20-page PDF document into a XeTeX document (both  
> use
> the same paper size). I have tried to use pdfpages, but I guess they
> don't fit together (it seems to have problems with the driver and it
> doesn't find the \includepdf command).

Yes, apparently pdfpages.sty is only distributed with driver files  
for pdfTeX and VTeX. In gwTeX:

/usr/local/teTeX/share/texmf.tetex/tex/latex/pdfpages/pppdftex.def / 

 From quick inspection of these files, it seems far from trivial to  
write a driver file for XeTeX (i.e., for either xdv2pdf or xdvipfmx).

> I guess xdvipdfmx can handle PDF documents (since dvipdfm does it). Is
> there any way to embed PDF documents with multiple pages in XeTeX?

I've embedded once a PDF document inside a XeTeX one by calling  
\includegraphics directly, but each page of the document was  
available as an individual PDF file:


and so forth. The \fbox is here to draw a frame around each page.  
[Note added in proof ;-) As I'm re-reading this, here comes a message  
from Jonathan Kew implying that the above would work in XeTeX by  
replacing \includegraphics{page1.pdf} with \includegraphics[page=1] 
{mydoc.pdf} etc.]

That said, ConTeXt is provided with a script texexec which includes,  
among other things, the possibility to manipulate PDF files  
(concatenating files, rearranging pages, and much more). Try "man  
texexec" in Terminal (texexec is included in gwTeX), and look for  
example at the --pdfcombine and --pdfselect flags.

 From an old post by me to the OS X TeX list:

> De : Bruno Voisin
> Date : 19 août 2003 16:34:07 HAEC
> À : "TeX on Mac OS X Mailing List"
> Objet : The joy of TeXexec (was Re: [OS X TeX] Re: PDF booklet making)
> Le samedi, 16 aoû 2003, à 13:23 Europe/Paris, Maarten Sneep a écrit :
>> try texexec --help. it gives a list of options. one of those seems  
>> to be "--result", with description: "resulting file =name     :  
>> filename". It seems to be what you need.
>>     texexec --pdfarrange --paper=A5A4 --print=2up -- 
>> result=outfile.pdf infile.pdf
> So far I had not paid much attention to messages and solutions  
> involving TeXexec, being an Apple devotee at heart and thus somehow  
> reticent to everything command-line.
> However, today a colleague asked me about a free (ie not involving  
> purchasing Adobe Acrobat) solution for extracting all odd or even  
> pages of a PDF document. There is a solution involving  
> pdfpages.sty, but it requires (i) creating a LaTeX file to compile  
> and (ii) specifying manually the pages to be included, as in:
> 	\documentclass[a4paper]{article}
> 	\usepackage{pdfpages}
> 	\begin{document}
> 	\includepdf[pages={1,3,5,7,9}]{complet.pdf}
> 	\end{document}
> Guided by the postings in the mentioned thread, and with only a  
> couple of minutes typing "man texexec" and browsing through the  
> output, I came out with the command-line solution:
> 	texexec --pdfselect --selection=odd --result=extrait.pdf complet.pdf
> which works wonderfully.
> A great praise for the capabilities of TeXexec, and for Gerben's  
> hard work at making this available to us with minimal fuss (for us,  
> not him)!
> Bruno Voisin

I think there are ConTeXt users on this list. Could texexec work with  

Hope this helps,

Bruno Voisin

More information about the XeTeX mailing list