I am using pdfpages which works quite well.

But this time, I want to include a 5 page pdf and the first page should be scaled down a bit such that above the first page is enough space for a subsection (in the LaTeX document).

Using just


\subsection{Interesting Letter}

does not work, because includepdf inserts a newpage command before the first page.

I looked at the pdfpages manual but could not find options relating to that.

I hacked this command, which kind of works:


\subsection{Interesting Letter}

The subsection is printed on the same page as the first page of the pdf, but an empty page is inserted before the section ...

The empty page vanishes if I scale the first page to 0.5 - which is too small ...

It seems that \includegraphics inserts an empty page before the graphic, if the inserted graphic violates the margins of the page.

Besides, the hspace value does not always fit.

Thus, my question: How to solve this right?

  • 1
    Did you try just \includegraphics?: PDFs can be used as images by pdfTeX.
    – Joseph Wright
    Commented Nov 24, 2010 at 17:35
  • @Joseph Wright, yes, like mentioned in the 2nd part of my post Commented Nov 24, 2010 at 18:42

6 Answers 6


You can use the pagecommand key:


You get the empty page when you use \includegraphics because the graphics are too large for the textbody, so latex tries if it fits on the next page (and then complain). pdfpages hides the size of the graphics so it is possible to insert complete pages which overwrites the margins. If you want to insert large graphics with \includegraphics: use eso-pic.

  • Unfortunately, what this actually does is insert a section on its own, and then inserts a pagebreak automatically - which means you cannot have any text between the subsection and the included pdf - even if you scaled it to something like 0.2 of the page... EDIT: actually ok - \def\excerpt{\section{Blah} .. \\ blah} and then pagecommand={\excerpt} works. Cheers!
    – sdaau
    Commented Jun 17, 2012 at 17:54
  • 3
    You can also add an introduction to the inserted subsection, e.g., \includepdf[scale=0.8,pages=1,pagecommand={\subsection{blub} This section includes the following attachment.}, offset=0 -1.5cm]{testpdf}. For better formatting, I've added offset=0 -1.5cm.
    – Yamaneko
    Commented Dec 11, 2018 at 16:42
  • You might consider including the offset that @Yamaneko mentioned in the answer. At least for me the output showed the pdf overlapping with the subsection-title without it.
    – Max
    Commented Nov 5, 2019 at 15:42

For me the following worked just fine:

\includepdf[pages=1,pagecommand=\section{Section Heading}]{testpdf}
  • Combines well with tex.stackexchange.com/a/62766/8666
    – 0 _
    Commented Dec 15, 2017 at 5:06
  • @IoannisFilippidis how do you see \phantomsection being used in relation to this answer?
    – minseong
    Commented Dec 4, 2020 at 14:23
  • For example: \includepdf[pages=1,pagecommand={\phantomsection \addcontentsline{toc}{section}{title} }]{filename}.
    – 0 _
    Commented Dec 6, 2020 at 11:35

It worked including a minipage.

  • 1
    This worked where none of the other options worked for me (I'm using the book class if it matters). Commented Feb 12, 2020 at 15:55

I tried this but the PDF overwrote the section heading. Add [offset=0 -3cm] and the PDF is dropped 3cm. All OK.

\includepdf[pages=1,pagecommand=\section{Section Heading}, offset=0 -3cm]{testpdf}
\includepdf[pages=2-,pagecommand={}, offset=0 -3cm]{testpdf}

I found an issue associated with the documentation of the section number. I added a label to the statements but this label is not recognized when used as a reference. However the TOC has the correct reference in line with that on the actual text on the PDF page.

Any suggestions as to fix this problem?

I am using this example:

\chapter{Technical Information}
\section{List of Technical Information}
 Text paragraph.\\
\textbf{Section Heading}  Refer \ref{newlabel} \\

\include[pages=1,pagecommand=\section{section Heading}, offset=0 -3cm]{testpdf}
\includepdf[pages=2- ,pagecommand={ }, offset=0 -3cm]{testpdf} 

If you include the label within the options e.g:

\includepdf[scale=0.8,pages={1},pagecommand=\section{Datenblätter Sensorik}\label{sec:appendix_db_sens}]{content/99_appendix/db/sensors/ds_kistler_9047C.pdf}

Then the label gets created correctly

  • Worked for me when using the PDF in a appendix. Commented Apr 17, 2020 at 15:44

There is a minor issue for labeling in the above code. Try this one

\includepdf[scale=0.8,pages={1},pagecommand=\section{sec:secname \label{sec:seclabel}}]{figname.pdf}

Note that the label is within the {} of section name.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .