1

I am creating a document in a4 and it shall actually be printed out on a3 sheets of paper.

Some bits of informations:

  • The main document will be set in a4, vertical/normal orientation.

  • The document through pdfpages shall be in a3, i.e. the a4 pages next to each other.

  • Although I am not sure if this is relevant, the a4 document I create will most likely have an equal amount of pages.

=> Is it possible to address the page before the last page with a variable or logical expression of some sorts? If yes, the code could be used somewhat universally, instead of writing out the actual (discreet) number of pagers.

So in relation to the code in "a3"-MWE below, the 3 could be that variable or expression. (pages={last,1-3},)

MWE for the a4 document

\documentclass[
11pt,
a4paper,
]
{scrartcl}

\usepackage{ lmodern, blindtext }

\usepackage[T1]{fontenc} \usepackage[utf8]{inputenc}

\usepackage{multicol}

\listfiles \begin{document} \begin{center} This document has 4 pages. \end{center} \begin{multicols}{2} \blinddocument \blindtext[7] \end{multicols} \end{document}

MWE for the a3 document

\documentclass[
11pt,
a3paper,
landscape,
]
{scrartcl}

\usepackage[T1]{fontenc} \usepackage[utf8]{inputenc}

\usepackage{pdfpages}

\listfiles \begin{document} \includepdf[pages={last,1-3},nup=2x1]{problem-pdpfages-second-last-page.pdf} %THIS IS JUST MY DOCUMENT NAME FOR THIS PROBLEM, please choose any document name how you see fit :) \end{document}

henry
  • 6,594

2 Answers2

2

I suppose you are looking for option signature:

\includepdf[pages=-, signature=4]{file.pdf}

Some people are bothered about the orientation of every second page. Well, there were times when it was easier to print it this way. But this shouldn't be an issue nowadays. If you prefer to rotate the pages back, use:

\usepackage{atbegshi}
\makeatletter
%%% luatex:
\AtBeginShipout{\ifodd\c@page\pdfvariable pageattr{/Rotate 180}\fi}
%%% xetex:
% \AtBeginShipoutFirst{\ifodd\c@page\special{pdf: put @thispage <</Rotate 180>>}\fi}
%%% pdftex:
% \AtBeginShipout{\ifodd\c@page\pdfpageattr{/Rotate 180}\fi}
\makeatletter

Note: In the near future it will be favorable to use the pdfmanagement code for rotating the page, i.e. \pdfmanagement_add:nnn{ThisPage}{Rotate}{180}.

2

You can use Get number of pages of external PDF to identify the total number of pages in the included PDF, and then calculate the before-last page from there:

\documentclass[
  11pt,
  a3paper,
  landscape,
]
{scrartcl}

\usepackage{pdfpages}

% Read in PDF to be included \pdfximage{temp.pdf} % Extract total number of pages and store it \edef\includePDFpages{\the\pdflastximagepages}

\begin{document}

% \number\numexpr\includePDFpages-1 yields the page before last \includepdf[pages={last,1-\number\numexpr\includePDFpages-1},nup=2x1]{temp.pdf}

\end{document}

Werner
  • 603,163