1

Suppose I have a document containing A n pages an another one (B) containing one page. How can I use pdfpages to create a landscape document has on the ith page the ith page of A on the left and B on the right, i.e.

1 page: page 1 of A, B
2 page: page 2 of A, B
3 page: page 3 of A, B
etc.

The solution should update automatically if n changes.

student
  • 29,003

1 Answers1

1

This doesn't use pdfpages, but I think it does what you ask. lipsum.pdf was a PDF containing just some \lipsum text, replace with your file A.

\documentclass{article} 
\usepackage[
  a4paper,
  landscape,
  showframe% show text area
]{geometry}
\usepackage{graphicx}
\usepackage[export]{adjustbox} % for valign key
\usepackage{pgffor} % for foreach
% get page count from PDF
% cf. e.g. https://tex.stackexchange.com/questions/8316
\pdfximage{lipsum.pdf}
\def\nbframes{\the\pdflastximagepages}
\begin{document} 
\pagestyle{empty}
\foreach \i in {1,2,...,\nbframes}
{%
\includegraphics[page=\i,width=0.47\linewidth,valign=c]{lipsum}\hfill
\includegraphics[width=0.47\linewidth,valign=c]{example-image}%
\newpage
}
\end{document} 
Torbjørn T.
  • 206,688