0

I have printed a few lists to pdf (on a4 pages) which I need to add as appendix to my project. It seems I can do this with \includegraphics or with \includepdf (from \usepackage{pdfpages}).

  • Includegraphics: Prints the first page , but keeps the top and left margins intact. Doesn't scale the image however, so the right and bottom margins are simply cut off. (The way Trello prints lists, it simply puts them all below eachother, one card-width wide, so the right-side being cut off is not so much a problem. The bottom part is, however.) Also, it doesn't print any other pages than the first.

  • IncludePDF: Prints all pages on top of each other, basically resulting in only printing the last page. It does print the page on the same page as the header, which is nice. However, the chapter caption and number are printed over the pdf itself. Also it sets the margins to zero so the page is inserted as-is. Besides that the page numbers are now gone.

I think the way to go is \includepdf, seeing the results I already "achieved". However, I'd rather not include every page manually, because even though this is only 3 pages I might go crazy and write documentation of say, 15 pages.

MWE incoming

\documentclass[11pt]{report}
    \usepackage{float}
    \usepackage{pdfpages}

\begin{document}
    empty page
    \newpage
    \appendix
    \chapter{Trello Board}
    %https://trello.com/b/MN172Syh/back-to-school -> print this page.

    \begin{figure}[H]
        \includepdf[pages=-]{trelloExample.pdf}
        \caption{Epics \& User stories}
        \label{apx:scrumboard}
    \end{figure}
\end{document}

So it seems that, up to the point where I simply added \includepdf, everything worked. And then I added the figure.

  • If you need to include multiple pages of a single pdf into your document, pdfpages is the package you need. Have you tried \includepdf[pages=-, pagecommand={\thispagestyle{headings}},scale=0.8]{<path-to-file>}? – ebosi Nov 14 '16 at 13:39
  • Sorry, will add that. I already do have that package (and I think it's mandatory in order to use \includepdf?) – Diamundo Nov 14 '16 at 13:41
  • I have now, and it still prints only one page: the last. (also you seem to be missing a bracket after headings ;) ) . When loading I can see it printing things on top of eachother, and the figure label is then printed a number of lines below the chapter heading (which leads me to believe for every page it prints an "empty" newline), instead of at the bottom of the page (preferably the last page) (oh and i see that the page number has now moved to the upper right corner intead of centered at the bottom) – Diamundo Nov 14 '16 at 13:46
  • 1
    Your \includepdf should not be embedded in a figure environment! – ebosi Nov 14 '16 at 14:15
  • it seems it shouldn't, indeed xD I guess this works now, and I'll see if I can't fix the problems now that it's no longer inside a figure. Thanks for your help! – Diamundo Nov 14 '16 at 14:17
2

Your issue is caused by the fact you're using \includepdf within a figure environment. You just have to remove it:

\documentclass[11pt]{report}
    \usepackage{float}
    \usepackage{pdfpages}

\begin{document}
    empty page
    \newpage
    \appendix
    \chapter{Trello Board}
    %https://trello.com/b/MN172Syh/back-to-school -> print this page.
        \includepdf[pages=-]{trelloExample.pdf}
\end{document}

You can note that giving a MWE speeds up the answering process (-;


Previous answer, written when no MWE had been given

This solution works for me:

  • Compile following code in order to generate dummy-example.pdf:

    \documentclass{scrartcl}
        \usepackage{lastpage}
        \usepackage{scrpage2}
        \pagestyle{scrheadings}
        \clearscrheadfoot
        \ohead{\texttt{dummy-example.pdf} --- Page \thepage\ of \pageref{LastPage}}
    
        \usepackage{lipsum}
    
    \begin{document}
        \lipsum[1-13]
    \end{document}
    
  • Include the this pdf into your main document via:

    \documentclass{scrartcl}
        \usepackage{lastpage}
        \usepackage{scrpage2}
        \usepackage{pdfpages}
        \pagestyle{scrheadings}
        \clearscrheadfoot
        \ohead{\texttt{main document} --- Page \thepage\ of \pageref{LastPage}}
    
    \begin{document}
        empty page
        \newpage
        \includepdf[pages=-,pagecommand={\thispagestyle{scrheadings}},scale=0.8]{dummy-example.pdf}% <-- adapt the path to the document accordingly
    \end{document}
    

You should then have a four-pages PDF, including the previous 3-pages pdf, and with heading:

enter image description here

  • This works for me... The primary difference I see: documentclass{scrartcl} (I use report) and your packages lastpage and scrpage2... Could you explain what they do, and why I would need them? – Diamundo Nov 14 '16 at 14:02
  • if I strip your answer down to \documentclass{report} \usepackage{pdfpages} \begin{document} empty page \newpage \includepdf[pages=-,scale=0.8]{test.pdf} \end{document} it still works (remove all other packages and change document class, and then had to remove pagecommand because it didn't recognize scrheadings)... What in the world am I doing wrong? I'll see if I can add an MWE of my own. – Diamundo Nov 14 '16 at 14:07
  • If this example work, it means you should provide a MWE in your question so that we could help you further. The lastpage package enables you to use \pageref{LastPage} in order to get the page number of the last page, and scrpage2 is KOMA-Script package for tweaking headers and footers as it is explained in the documentation. \documentclass{memoir} \usepackage{pdfpages} \begin{document} empty page \newpage \includepdf[pages=-,pagecommand={\thispagestyle{headings}},scale=0.8]{<PATH>} \end{document} works as well. – ebosi Nov 14 '16 at 14:07

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.