2

I have a pdf and need to have each second page turned upside down, so that I can print it twosided. I found pdfpages rotate odd pages 180º and changing

 \foreach \p in {1,...,\the\pdflastximagepages}{%
  \ifnumodd{\p}%
    {\includepdf[pages=\p,angle=180]{\jobname-step1}}%
    {\includepdf[pages=\p]{\jobname-step1}}%
}

to

 \foreach \p in {1,...,\the\pdflastximagepages}{%
  \ifnumodd{\p}%
    {\includepdf[pages=\p,angle=180]{\jobname-step1}}%
    {\includepdf[pages=\p+1]{\jobname-step1}}%
}

(amongst other changes) would do the job I think. But adding the \p+1 gives an error. I tried it with the package calc, but without any luck.

  • 1
    Many printer drivers can be configured to do this for you automatically (no LaTeX required). – Steven B. Segletes Sep 2 '16 at 10:48
  • 3
    please, why are you doing this (\p+1) in the first place? – touhami Sep 2 '16 at 11:25
1

Try

\foreach \p in {1,...,\the\pdflastximagepages}{%
  \ifnumodd{\p}%
    {\includepdf[pages=\p]{\jobname-step1}}%
    {\includepdf[pages=\p,angle=180]{\jobname-step1}}%
}
1

After some long hours I got the following to do the job:

\documentclass[landscape]{article}
\usepackage{pgffor,pgfmath,pdfpages}

\def\originalfile{backlog-grooming.pdf}

\begin{document}

\pdfximage{\originalfile}%
\foreach \p in {1,3,...,\the\pdflastximagepages}{%
   \pgfmathparse{int(\p+1)}%
   {\includepdf[pages=\p]{\originalfile}}%
   {\includepdf[pages=\pgfmathresult,angle=180]{\originalfile}}%
}


\end{document}

In the file backlog-grooming.pdf every second page is turned upside down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.