As suggested here, I'm using \includepdf
to insert several multi-page PDF files of musical scores into a LaTeX document:
\newcommand{\insertScore}[3] {
\addcontentsline{toc}{section}{#2}
\includepdf[scale=0.8,pages=1,pagecommand=\section*{#2}]{#1/score.pdf}
\includepdf[scale=0.8,pages=2-,pagecommand={}]{#1/score.pdf}
… more stuff following
}
However, while most of these PDFs consist of two or more pages, some have only one single page, which makes the second \includepdf
fail. Is there any way to work around this issue without knowing in advance, how many pages the included PDF will consist of? The LaTeX file is generated automatically in this project, therefore using different commands for different PDFs isn't really an option ...
\documentclass
and ending with\end{document}
) than code fragments like this. This allows people to reproduce your problem and test their solutions. It also often helps you in understanding your own problem better.