[Tex/LaTex] How to use background image in LaTeX

graphics

I am generating one report where I need to use background image. But I found that image always starts leaving some margin space to left side.

\documentclass{article}
\usepackage{wallpaper}
\usepackage{mdframed}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\begin{document}
 Some content
\ThisLRCornerWallPaper{1.0}{image.jpg}
\end{document} 

How can I use background image covering whole page?

Best Answer

You can do this in number of ways. I will show three more methods.

With tikz:

\documentclass{article}
\usepackage{tikz}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\begin{document}
 Some content
\tikz[remember picture,overlay] \node[opacity=0.3,inner sep=0pt] at (current page.center){\includegraphics[width=\paperwidth,height=\paperheight]{example-image}};
\clearpage
text
\end{document}

With eso-pic:

\documentclass{article}
\usepackage{eso-pic,graphicx}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\begin{document}
 Some content
\AddToShipoutPictureBG*{\includegraphics[width=\paperwidth,height=\paperheight]{example-image}};
\clearpage
text
\end{document}

\AddToShipoutPictureBG (instead of \AddToShipoutPictureBG*) puts the background in all pages.

With background package:

\documentclass{article}
\usepackage[top=2cm, bottom=2cm, outer=0cm, inner=0cm]{geometry}
\usepackage[pages=some]{background}

\backgroundsetup{
scale=1,
color=black,
opacity=0.4,
angle=0,
contents={%
  \includegraphics[width=\paperwidth,height=\paperheight]{example-image}
  }%
}
\begin{document}
 \BgThispage
 Some content
 \clearpage
 text
\end{document}

enter image description here

Related Question