latex includepdf after section in appendix

Found the solution here: https://tex.stackexchange.com/questions/5911/how-to-include-pdf-pages-without-a-newpage-before-the-first-page

the only thing is to add the \section in the pagecommand of \includepdf like this:

\includepdf[pages=-,scale=.8,pagecommand={\section{title 1}\label{}},linktodoc=true]{myPDF1.pdf}
\includepdf[pages=-,scale=.8,pagecommand={\section{title 2}\label{}},linktodoc=true]{myPDF2.pdf}
....

thanks guys.

UPDATE: i noticed that \label{} is not working in the pagecommand, hence i cannot reference to any of these appendix-files. is there another workaround?


Another stylish solution in case of adding multi page documents:

\includepdf[pages=1,scale=.8,pagecommand={\section{My header}\label{pdf:myfile}},linktodoc=true]{myfile.pdf}
\includepdf[pages=2-,scale=.8,pagecommand={},linktodoc=true]{myfile.pdf}

Features:

  1. Header placed at the top of the first page without cropping
  2. You can set a label for the section created
  3. Multi page friendly

Tags:

Latex

Pdflatex