# How to include a pdf image

All I am trying to include a pdf image in my tex file, but when I compiled the tex file, the console pop up the following error msg:

! LaTeX Error: Cannot determine size of graphic in time_elapsed.pdf (no Boundin gBox).

This is my code:

\begin{figure}
\centering
\includegraphics[scale=0.5]{time_elapsed.pdf}
\label{fig5}
\end{figure}


So how to solve the problem?

-
Which driver you are using (pdfTeX, LuaTeX, XeTeX, dvips, dvipdfm, ...)? –  Heiko Oberdiek May 14 at 21:46
@HeikoOberdiek:I have updated my post, it is a different error msg now, I dont know how to fix it. –  daiyue May 14 at 21:48
You're probably using latex which only accepts EPS files and not PDF. –  egreg May 14 at 21:48
I have used a few eps files as well, so i can't use pdflatex, coz my other eps files wont be compiled –  daiyue May 14 at 21:51
Just convert the EPS files to PDF. Depending on your TeX distribution, this can even be automatic if you load the epstopdf package. –  egreg May 14 at 22:04
show 1 more comment

## 2 Answers

! LaTeX Error: Cannot determine size of graphic in time_elapsed.pdf (no Boundin gBox).

That looks very much like the error produced by latex when you try to include pure PostScript (.ps) image instead of encapsulated PostScript (.eps). Are you sure you are using pdflatex command for TeX-ing?

-
add comment

Try to compile the following with pdflatex. The simplest workflow should be like the following.

\documentclass[preview]{standalone}
\usepackage{graphicx}

\begin{document}
\includegraphics{example-image-a}% no need to explicitly specify the file extension.
\end{document}


You will get an output as follows.

## Useful links:

-
If you include the mwe package it becomes a MWE. –  percusse May 14 at 21:50
@percusse: But it still works without mwe package. –  Stiff Jokes May 14 at 21:51
Loading the mwe package once, makes the images to stay available even when the package is not loaded. –  percusse May 14 at 21:52
@percusse: I am trying to parse your sentence. –  Stiff Jokes May 14 at 21:53
add comment