# How to include a PDF image into a PDFLaTeX document

I am generating a PDF file using pdflatex and need to include another PDF file. The reason is that I have a graphMl file which I exported from yEd graph editor to a PDF file, named sample.pdf. The TeX code to be compiled with pdflatex is given below. I need to include that file at the start of the document.

\documentclass[a4paper,leqno,twoside]{article}

\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage{multirow}

\begin{document}

[% FOREACH st IN Service %]
Name,Id:
[% st.Id %], [% st.Name %]

des:
[% st.Description %]

Customers:
[% FOREACH softservice IN st.Customers %]
[% FOREACH swid IN softservice.SW %]
[% swid.Service %]
[% FOREACH st IN Service %][% IF swid.Service == st.Id %]
([% st.Name %])

[% END %] [% END %][% END %][% END %]

Suppliers:

[% FOREACH shservice IN st.Suppliers %]
[% FOREACH sw IN shservice.SW %][% sw.Service %]
[% FOREACH st IN Service %][% IF sw.Service == st.Id %]([% st.Name %])
[% END %][% END %][% END %]

[% FOREACH hw IN shservice.HW %][% hw.Type %][% hw.Nr %][% END %]
[% END %]
\newpage
[% END %]
\end{document}

-
I'm curious: That code looks badly broken and doesn't make much sense (most of it is commented out). Is yEd that bad? –  Martin Schröder Dec 28 '11 at 11:21

Have a look at the pdfpages package

\documentclass{article}

\usepackage{pdfpages}

\begin{document}
\includepdf[<options>]{<file>}

\end{document}


Edit Miguel suggested graphicx to include a graphic which is correct, the difference between graphicx and pdfpages is that graphicx puts the PDF as a graphic on a text page (maybe inside a {figure} float environment, whereas pdfpages inserst the pages of a given PDF between the pages of your document.

-
Thanks for your answer, its working. –  pavani Dec 28 '11 at 10:18
I have small problem when I try to insert external pdf image into my pdflatex document on page 13 and one more image on page 14, I am not able to insert external pdf images on specific page number.my problem is I need to insert exteranl pdf images on bottom side of page 13 and page 14. Can you help me with that.I tried to insert but it inserting on starting page of latex generated pdf. –  pavani Jan 2 '12 at 15:57
@pavani: I’m not sure if I understood you right (please add a new MWE to your question showing the problem) … If you want to include the external PDF as part of a LaTeX-page use \includegraphics instead of \pdfpages –  Tobi Jan 2 '12 at 17:35

Loading the graphicx package in the preamble it is possible to import PDF images in the document:

\documentclass{article}
\usepackage{graphicx}

\begin{document}

\includegraphics[<options>]{filename.pdf}

\end{document}


Here <options> can be e.g. width=<width>, height=<height or page=<page number>. See the Graphics Guide for more details.

-
Thanks for your answer, its working. –  pavani Dec 28 '11 at 10:19
I have small problem when I try to insert external pdf image into my pdflatex document on page 13 and one more image on page 14, I am not able to insert external pdf images on specific page number.my problem is I need to insert exteranl pdf images on bottom side of page 13 and page 14. Can you help me with that.I tried to insert but it inserting on starting page of latex generated pdf. –  pavani Jan 2 '12 at 15:59
To include a figure in the bottom of the page you could use a figure environment in the document where you want to have the figure: \begin{figure}[b]\includegraphics[<options>]{filename.pdf} \end{figure} . For more information about positioning of figures see en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions#Floats –  Miguel de Val-Borro Jan 4 '12 at 15:03
+1 This is the best answer here! Includegraphics much better to use than a new command. –  Masi Oct 29 at 21:09