TransWikia.com

How to include a PDF image into a PDFLaTeX document

TeX - LaTeX Asked by pavani on May 19, 2021

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}

3 Answers

Have a look at the pdfpages package

documentclass{article}

usepackage{pdfpages}

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

   Your Text
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.

Correct answer by Tobi on May 19, 2021

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.

Answered by gypaetus on May 19, 2021

I use the package epstopdf to insert graphic in format different than those that Latex commonly processes. It works for .pdf, .tiff, etc.

documentclass{article}

usepackage{epstopdf}
epstopdfDeclareGraphicsRule{.pdf}{png}{.png}{convert #1 OutputFile}
AppendGraphicsExtensions{.pdf}

begin{document}

includegraphics[<options>]{filename.pdf}

end{document}

Answered by Nam Tran-Hoang on May 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP