[XeTeX] XeTeX and pdfpages: no dice?

Andreas Matthias amat at kabsi.at
Sun Apr 15 03:32:43 CEST 2007

Luis Sequeira wrote:

> It appears, though, that pdfpages is not compatible with
> XeLaTeX. Is  there any way to replicate this functionality in
> XeLaTeX?

Here is a first beta version of pdfpages with a XeTeX driver file:


I am totally new to XeTeX (actually, yesterday I ran XeTeX for
the first time), so I'm not sure I did things right. Especially
the driver business of XeTeX puzzles me a bit. XeTeX has a built-in
driver (any name for that?), which can output PDF directly; but
then there also exist xdvipdfmx, which is actively developed as
far as I can see. Why do I need xdvipdfmx and why is it not
embedded into xetex?

I seems to me that it is somehow possible to include PostScript
files as well. I tried it with `xetex -no-pdf' followed by
xdvipdfmx but got the message `No image converter available'...

I suppose these are all FAQs. But I couldn't find enough information
on that. Could you give me a hint?

Anyway, just try the beta version and tell me how/if it works.
I tested pdfpages by just calling the xetex binary directly; no
options like -output-driver, -no-pdf and no external dvi->pdf
converter. I am working on Linux if that matters; just heard
of a xdv2pdf for MacOS -- one more driver business ... good lord.

If you need support for other ways of creating documents with
xetex/xdvipdfmx/xdv2pdf or whatever just tell me and I will see
what I can do.

To detect the number of pages of a PDF file, I used some really
clever macro code that Heiko Oberdiek send me some years ago.
I am not sure if it is really foolproof and it is not too fast,
since it parses the whole PDF. But it is really wonderful to
see what can be done on TeX macro level.

Oh, I nearly forgot that: Why do \pdfpagewidth and \pdfpageheight
not have sensible defaults. Concerning pdftex these dimens are
set in pdftexconfig.tex which is read when creating the format
files. Wouldn't this be usefull for xetex as well?

Pdfpages' fitpaper option stumbles if \pdfpage{width,height} are
not set correctly and so the dimensions of the next page are not
reset. That's why I had to set them to \paper{width, height} in
the xetex driver file. But I really don't like that.

While working on pdfpages' XeTeX driver I came across a few
things that I miss in XeTeX:

* Detecting the number of pages of a PDF document.

* Clipping of graphics.

* FitR destinations. The following is a pdftex example,
  to show how FitR destinations work.

  \hyperlink{foobar}{Kick me!}
  \pdfdest name {foobar} fitr
           width \the\wd\mm height0pt depth\the\ht\mm

  The closest I can come with XeTeX is
  \special{pdf: dest (foobar) [ @thispage /XYZ @xpos @ypos 0]}
  but that's definitely not the same.


More information about the XeTeX mailing list