I have a multipage PDF manuscript (for example, my_PDF.pdf) that I would like to include in a new document. I would also like to trim/clip off the header and footer from each page of this included pdf.
In the past, with regular LaTeX, I have done this very simply with something like
\documentclass[letterpaper]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages={1,2},trim=0.45in 0.625in 0.45in 0.625in, offset=0.25in 0in, width=6in, clip=true, pagecommand={}]{my_PDF}
\end{document}
as described at http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics.
However, this time I need to do it in XeTeX for Unicode support, and the above method doesn't work because clipping isn't supported yet in XeTeX. I've managed to come very close by using the nice adjustbox package, which lets you (almost) transparently redefine the \includegraphics macro in a way that supports clipping:
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\setlength{\pdfpagewidth}{8.5in} % Something wrong with my compiler setup
\setlength{\pdfpageheight}{11in}
\documentclass[letterpaper]{article}
\usepackage{pdfpages}
\usepackage[Export]{adjustbox}
\begin{document}
\includepdf[pages={1,2},trim=0.45in 0.625in 0.45in 0.625in, offset=0.25in 0in, width=6in, clip=true, pagecommand={}]{my_PDF}
\end{document}
But now I'm stuck again because it doesn't seem the \adjustbox way can select different pages in the multipage PDF (i.e. this second code example repeatedly inserts the same properly-trimmed first page).
Is there a way to make this work? Maybe I'm missing a way to select the pages? Or somehow use the original way to insert the pages, in combination with some sort of pagecommand={\adjustbox{...}} key to the \includepdf macro? (I tried this too, but I am a relative novice and couldn't get it going) Perhaps there's a totally different method that I'm missing. Basically, I just want to be able to insert a cropped/trimmed multipage PDF document inside an XeTeX document.
lualatex? As far as I recall, clipping should work there (just as forpdflatex) because it’s based on PDFTeX whereasxelatexcreates the PDF from an intermediate “enhanced DVI” format. – ilpssun Mar 16 '12 at 10:25pdflatexandpdfpagesand subsequently include the cropped pages in theXeLaTeXdocument? – Martin Heller Mar 28 '12 at 21:44pdfcrop2, since I didn't have that many pdfs to insert. I'm still curious about if/when there will be a way to solve this without the extra outside step. – John Colby Mar 28 '12 at 23:22lualatexbefore, but from reading a bit it's sounding like it might eventually surpassxelatexfor typical users like me. I will definitely give it a shot and see if it goes smoothly or if I bump into any other issues... – John Colby Mar 28 '12 at 23:27