This is a follow-up on another thread in which I got advise on how to \includepdf with section and subsection titles on the included pdf: \includepdf jumps to new page - can I avoid that?

The proposed \resizebox + \includegraphics solution does seem to solve the with single-page pdfs. However, with the solution in the above thread, my multi-page pdf is treated as a single-paged, i.e. only the first page is included. As is also suggested, the rest of the pages in the multi-page def-file can afterwards be included by \includepdf[pages={2- }.

Combining these two commands are not very convenient but could be feasible, except the first page is scaled and positioned different from the rest of the pages.

For me, it is quite complex to make a MWE in this case and hence I will (at least for now) just present the code and a snapshot of the output file.

\begin{center} %centre on page
    \resizebox{1.0 \textwidth}{!}{ %resize inserted page
    } %close resizebox    

\includepdf[pages={2- }, scale=0.755,pagecommand={\thispagestyle{plain}}] {appendix/Initial-presentation-of-the-project.pdf}

Please note the different scale values in the code snippet and the different positionss of the boarders on page 35 and 36 in the left side of the output file. The following pages are similar to page 36.

The boarders of pages 35 and 36

After using the latest suggestion by @Tom Kelly, the size issue is solved. The issue with position is not used but has minimised:

enter image description here

  • 1
    Do you want the included page at the same position on each page? i.e., so there is a gap at the top of each page large enough for a heading, even if the heading only appears on the first page of each appendix? – David Purton Jul 10 '18 at 14:26
  • I actually didn't think of hat, but I think would be neat. – jbahn Jul 10 '18 at 14:28
  • I have an idea. – David Purton Jul 10 '18 at 14:29

\includepdf has a width argument. Use this instead of scale to give the exact width:


\section*{Appendix of Introduction}

\subsection*{Appendix a: Initial presentation of the project}

\begin{center} %centre on page
\resizebox{\textwidth}{!}{ %resize inserted page
\includegraphics[page = 1]{{"appendix/Initial-presentation-of-the-project.pdf"}}
} %close resizebox    

\includepdf[pages = {2- }, width = \textwidth, pagecommand = {\thispagestyle{plain}}] {appendix/Initial-presentation-of-the-project.pdf}
  • Thanks for the persistence, @Tom Kelly. This is much better, but actually there is still a little difference between the position of the first (p. 35) and the latter pages. Since I cannot add ta snapshot here, I will edit the OP to add one there. – jbahn Jul 10 '18 at 13:38
  • Do you think we can solve that? – jbahn Jul 10 '18 at 13:42
  • I suspect one of two issues: 1) the remaining pages must scaled to allow space of the section headers (if you want the width to match). Perhaps scaling by height rather than width would address this. 2) the first page is centred and the remainder of the PDF is aligned to the left. I’d suggest to centre align the PDF pages: you may need to do this as demonstrated for includegraphics since I don’t see an option for alignment in the includepdf documentation: texdoc.net/texmf-dist/doc/latex/pdfpages/pdfpages.pdf#page2 – Tom Kelly Jul 10 '18 at 13:53
  • There is no doubt, that the first page is the problem. The following are right in the middle of the page, while the first page is slightly off the center line. – jbahn Jul 10 '18 at 14:12
  • I just tried to omit the \begin{center} and \end{center}. Apparently it makes no difference. – jbahn Jul 10 '18 at 14:14

I wrote a package called pdfoverlay which allows you to overlay text on to an existing PDF. With slight modification to the macro that positions the PDF on to the page, you could make it place each PDF at the bottom of the page text and scaled to \textwidth.

You could use the adjustbox to frame each page easily.

It's possible to put each PDF page anywhere at any size on the page.

Something like this:

% use adjustbox to frame each page
% Options for include graphics to scale to text width and frame each page
\pdfoverlaySetGraphicsOptions{keepaspectratio, width=\textwidth, frame}
% slightly redefine \__pdfoverlay_format_pdf_page: so that pdf page is placed
% at the bottom of the page text, rather than at the centre of the page
\cs_set:Nn \__pdfoverlay_format_pdf_page:
                \exp_not:N \includegraphics
                  [ \clist_use:Nn \g__pdfoverlay_graphics_options_clist { , } ]
                  { \g__pdfoverlay_pdf_file_name_str }
\subsection*{Appendix A}
\subsection*{Appendix B}
\subsection*{Appendix C}
  • Thanks for the efforts. Just to be sure: Are you aware that the my pdfs have multiple pages? Should it still work? – jbahn Jul 10 '18 at 14:48
  • Yes, the \pdfoverlayIncludeToLastPage macro includes all pages in a multi page pdf – David Purton Jul 10 '18 at 15:00
  • I am getting a File 'pdfoverlay.sty' not found. \pdfoverlaySetGraphicsOptions error – jbahn Jul 10 '18 at 15:16
  • It's only been in texlive and miktex for a couple of months, so you might need to upgrade packages or grab it off ctan – David Purton Jul 10 '18 at 15:20
  • I actually have some other packages that need upgrading, but I don't knoe how to do it. Is there an easy way? – jbahn Jul 10 '18 at 15:36

IMO the \resizebox+ \includegraphics combination is a heavy hack that doesn't take advantage of the pdfpages package which was considered as an option. The cropping and size control of this package can be used for a simpler code, if one use the powerfull pagecommand option.

Here is a MWE which produces a regular appendix, and the a second one the content of which is a portion of the pdf doc of the pdfpackage itself. I assume that the first page you want to include gas a usefull height significantly smaller that the regular page, as the chapter header takes some place

\chapter{My first appendix}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

\includepdf[width=\paperwidth,pages={1},trim={0in 1.5in 0in 5in},clip,
pagecommand={\chapter{My second appendix}},offset={0mm -2in}]{pdfpages.pdf}

\includepdf[width=\paperwidth,pages={2-4},trim={0in 0in 0in 0in},clip,
pagecommand={},offset={0mm -0.5in}]{pdfpages.pdf}


In this code, one include a selected part of the first page (defined by the two non vanishing trim parameters. The offset is used to vertically position the portion to iake in two account the headein height and the footer height in the master document (rule of thumb : bottom trim value minus height of the bottom margin).

For the other pages, page command must be kept empty to ensute taht the running headers will be typeset, and the offset is still used to acomodate the different layout of the two documents. Result looks like (width the frame option added in \includepdf to visualize the offsets) :

enter image description here

With this strategy, there is no need to do anything to keep the initial text fully unscaled. Obviously, your would have to adjust the trim and offset paramters if you want to cut out the page numbers of the source PDF.

  • Thanks. I don't want to use chapter, and all my pdf pages a originally A4 and have to stay that way, though scaling is ok. Would it work with sections and full pages? – jbahn Jul 10 '18 at 15:18
  • The short answer i YES. Hoever I'm not sure to understand. I'mmore used ith book where appendices are \chapter but actually in article they are \section. The described solution works exactly the same way if you replace \chapter by \section. But the IMO the fullpage doesn't make sense, because the section header takes some space. If the top of the first included page is sufficiently empty, it will nevertheless work without trim nor offset. But in the opposite (more general) ill need some cropping or some scaling. – Jhor Jul 10 '18 at 15:39
  • It doesn't seem to let me keep the section and the subsection title at the same page (I am using the report document class). – jbahn Jul 10 '18 at 15:48
  • Of course ! As i said, witt neither crop nor scaling you can't, as i tried to say in my previous comment.. If yiu dont want tu uses this aporach, you will need resort to an overlay lechanisl, as suggested in another answer, or maybe more simply using the eso-pic package – Jhor Jul 10 '18 at 16:14
  • In the end I have chosen to use Tom Kelly's suggestion above with a slight modification. But thanks a lot for trying to help me out. – jbahn Jul 10 '18 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.