# Join several pdf files 4 on 1 page

## Issue

I want to join several pdf files to a single pdf with 4 pages on one page and continuously proceeding pages using just one SINGLE tex file. Something like:

\documentclass[a4paper,10pt]{article}
\usepackage{pdfpages}
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper]
\begin{document}
\includepdf[pages=-]{page1.pdf}
\includepdf{page2.pdf}
\includepdf{page3.pdf}
\includepdf{page4.pdf}
\end{document}


but pdfpages seems to stay in conflict with pgfpages.

## Until now

So far I always used two tex files:

\documentclass[a4paper,10pt]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-]{page1.pdf}
\includepdf{page2.pdf}
\includepdf{page3.pdf}
\includepdf{page4.pdf}
\end{document}


and

\documentclass[a4paper,10pt]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-,nup=2x2]{temp.pdf}
\end{document}


## Condition

I do not want to use pdfjam as it does almost the same as pdfpages.

## Update

Is there a way to generalize this also to different layout like nup=2x3? 6 to 1 is undefined in \pgfpagesuselayout.

## Another Ansatz

Maybe using the package bashful wrong.

MWE:

\documentclass[a4paper,10pt]{article}
\usepackage{pdfpages}
\usepackage{bashful}

\begin{filecontents}{temp}
\documentclass[a4paper,10pt]{article}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=-]{page1.pdf}
\includepdf{page2.pdf}
\includepdf{page3.pdf}
\includepdf{page4.pdf}
\end{document}
\end{filecontents}

\begin{document}

\bash{ shopt -s nullglob; pdflatex temp.tex; done; }
\END

\includepdf[pages=-,nup=2x2]{temp.pdf}
\end{document}

-

By loading pgfpages before pdfpages, it works:

\documentclass[a4paper,10pt]{article}

\usepackage{pgfpages}
\usepackage{pdfpages}
\pgfpagesuselayout{4 on 1}[a4paper]

\begin{document}
\includepdf[pages=-]{page1.pdf}
\includepdf{page2.pdf}
\includepdf{page3.pdf}
\includepdf{page4.pdf}
\end{document}

-