[Tex/LaTex] Center image in landscape mode

graphicshorizontal alignmentlandscapevertical alignment

I've used the \usepackage{pdflscape} instruction and the following code for inserting an image in a landscape oriented page.

\begin{landscape}

\begin{figure}[p!]
\centering
\includegraphics[scale=0.4]{./images/SelectDVA.png}
\caption{DVA selection Use Case.}
\end{figure}

\end{landscape}

This is the outcome:

enter image description here

I'd like the image to be centred vertically and horizontally, put playing with \vspace or \hspace didn't help me.

What is the correct way of doing it?

Best Answer

From your picture it seems that the image scaled at 40% is still too wide for the page, so an overfull box is produced (and the excess goes to the right, which is the top of the rotated page).

While adding something like \hspace*{-1cm} (tune the length to your needs) would somewhat cure the problem, the caption would not be centered to the image any more.

Probably you should better do

\includegraphics[width=\hsize]{./images/SelectDVA.png}

or

\includegraphics[width=0.95\hsize]{./images/SelectDVA.png}

to give some more room. Unfortunately, it seems that the real textwidth is not available when using pdflscape (the fault is in lscape from which the former depends), so \hsize should be used.