[Tex/LaTex] \includegraphics forces new page

blank-pagegraphicsincludegraphicspage-breakingscaling

When I include a PDF diagram, it forces a new page, so I have one blank page and then this diagram, can somebody help me please? I need to remove that blank page.

My document looks like this

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{a4wide}
\usepackage{pdfpages}
\usepackage[total={17cm,25cm}, top=2.0cm, bottom=1cm, left=0.0cm, right=0.0cm, includefoot]{geometry}

\begin{document}
\newgeometry{total={17cm,25cm}, top=2.0cm, bottom=1cm, left=2.0cm, right=2.0cm, includefoot}
\section*{Diagram případů užití}
\includegraphics[width=\textwidth]{diagram.pdf}
\end{document}

and the resulting output is

output result with blank page

Best Answer

The image is too large to fit on current page, because there is not much place left. It is also too large to fit on a page of its own, therefore moving to the next (last?) page, where it is apparently placed using some emergency rule even if it doesn't fit there either.

You should include the image using the following options instead:

\includegraphics[width=\textwidth,height=\textheight,keepaspectratio]{diagram.pdf}

This tries to scale it to the textwidth but not larger than the textheight while keeping the aspect-ratio.

To allow enough space for a caption you should reduce the height a little, e.g. either take only .9\textheight or subtract two lines or so from it.

\includegraphics[width=\textwidth,height=\dimexpr\textheight-2\baselineskip\relax,keepaspectratio]{diagram.pdf}

From the look of it it might also belong into a figure environment. There you should add a \centering before the \includegraphics to have it centered.