149

I have a PDF file with multiple figures; each figure is a separate page in the PDF file.

I am using pdflatex, and I would like to use \includegraphics or equivalent to include some of the figures.

Of course I could use an external tool to split the PDF file into multiple one-page PDF files. Then I could use \includegraphics as usual. However, I would have a much simpler workflow if I could avoid this extra step. Hence the question:

How can I include, e.g., page 3 of foo.pdf as a figure?

I am aware that there is a Latex package called pdfpages, but it seems to be designed for something else: with pdfpages, each page in the input file will produce a full page in the final document, not just a box.

2 Answers 2

190

graphicx (the extended version of graphics) knows the page option:

\includegraphics[page=3]{foo}

should work, or

\includegraphics[page=..,trim=...,clip]{foo}

for only parts of the page. If you want to include more than one page then use Package pdfpages and the command \includepdf

10
  • 7
    Many thanks, it indeed works! I was already writing that I would like to do something like \includegraphics[page=3]{foo}, but didn't try it, as I couldn't find anything like that in the documentation of the graphicx package... Thus a follow-up question that might help me and others in the future: where is the page= option documented? Commented Dec 29, 2010 at 19:35
  • 4
    that is defined only for the driver pdftex, the reason why you find it not in graphicx, but in the file pdftex.def
    – user2478
    Commented Dec 29, 2010 at 19:53
  • 12
    But that effectively means that it's not documented at all, since pdftex.def certainly isn't where anyone should look for such information, and other that a single mention that the graphicx package has "automatic pdfTeX support", the pdftex documentation isn't really helpful either. (I've been using graphicx for years and didn't know about this either.)
    – Alan Munn
    Commented Dec 29, 2010 at 21:17
  • 3
    Anyone knows how to put not a entire page, but just a piece. I mean, just 60% of one page in a pdf file.
    – João
    Commented Mar 7, 2013 at 19:51
  • 4
    @João: use \includegraphics[page=..,trim=...,clip]{file.pdf}
    – user2478
    Commented Mar 8, 2013 at 8:32
4

Here another possibility using graphics package. In this way you can include each one of the pages than you want from your pdf file ([page= number of the page in the pdf file that you want to include). In the example I want to include a big table that I do in pdf having 2 pages and including that in the TOC like table.

\begingroup

\begin{sidewaysfigure}

    \begin{center}
    %\fbox{
    \includegraphics[page=1, width=\linewidth]{Foo}%}
    \end{center}
\end{sidewaysfigure}


\begin{sidewaysfigure}

    \begin{center}
    %\fbox{
    \includegraphics[page=2, width=\linewidth]{Foo}%}
    \captionof{table}{Caption}
    \label{Zones_intervention_tab}
    \end{center}
\end{sidewaysfigure}

\endgroup
1

You must log in to answer this question.

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