[Tex/LaTex] Blank page when using pdfpages package

blank-pagepdfpages

I have a file fooo.pdf with dimension 210mm x 70mm and 6 pages (simple grey background).

I'm using pdfpages to include the pages inside an A4 page.

So the ideal number is 4 pages per page. But the problem is that the output has a blank page at the beginning.

Why? How to fix it?

MWE

\documentclass{report}
\usepackage[margin=0cm,a4paper]{geometry}
\usepackage{pdfpages}
\begin{document}%
\noindent\includepdf[nup=1x4,pages=-]{fooo.pdf}%
\end{document}

Output

enter image description here

Best Answer

pdfpages inserts \newpage before inserting any content, as well as after the content has been inserted. As such, anything set before the issue of the \newpage would cause a complete page break. The primitive \noindent here switches to horizontal mode and therefore initiates a paragraph, even though nothing is set. As such, the \newpage leaves a visible blank page. Remove it to avoid the first blank page.

You could also consider using atbegshi to process pages before they're shipped out, and perhaps conditionally (\AtBeginShipoutFirst) discard them using \AtBeginShipoutDiscard.