[Tex/LaTex] How to include a pdf image

graphicspdf

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?

Best Answer

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.

enter image description here

Useful links: