# Include several pages of a PDF without losing LaTex document style

I would like to include several pages of a PDF as a subsection in my LaTex Document using the package pdfpages. I tried

\includepdf[scale=0.8,pages=1-5,pagecommand=\subsection{blub}]{testpdf} 

from the question How to include PDF pages without a newpage before the first page? But unfortunately every single page of the pdf becomes a new subsection though I would like to have just one subsection with five pages. The default setting \includepdf[scale=0.8,pages={1-5}]{pdfdocument} for pagecommand does not work for me either, because I want the normal page numbers, headseplines and so on to appear. I have no idea which option for pagecommand I could use to make this work. Thanks a lot for your help!

-
Try pagecommand={} to disable the standard command which will use the empty page style. –  Martin Scharrer Sep 13 '12 at 17:59
Thanks a lot. Works perfectly! –  Apatura Sep 13 '12 at 18:19
Wonderful. I posted it as an answer now. If you click the checkmark at the upper left of the answer you can accept it. This way the question is marked as concluded. However, it is a good idea to wait a little, because other people might post better answers a little later. –  Martin Scharrer Sep 13 '12 at 18:22

The default pagecommand uses \thispagestyle{empty} which disables page numbers, headers and footers etc. You can use pagecommand={} to overwrite this and get normal layout for these pages.
I used \includepdf[scale=0.8,clip,trim=0cm 0cm 0cm 2cm,pages={1},pagecommand={\section{appendix}\subsection{part1}}]{pdfdocument} \includepdf[scale=0.8,clip,trim=0cm 0cm 0cm 2cm,pages={2-5},pagecommand={}]{pdfdocument} to avoid an empty page under the section. And the trim command to get rid of the page numbers of the PDF. Now it is exactly the way it ought to be. –  Apatura Sep 14 '12 at 0:55