0

I am using \documentclass{article}, how would I create one page with backround image without margins, so the background image would span the whole page?

I am using this:

\usepackage{eso-pic}
\newcommand\BackgroundPic{%
\put(0,0){%
\parbox[b][\paperheight]{\paperwidth}{%
\vfill
\centering
\includegraphics[width=\paperwidth,height=\paperheight,%
keepaspectratio]{img0016.png}%
\vfill
}}}

Then for the page this:

\newpage
%\newgeometry{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2cm}
\AddToShipoutPicture*{\BackgroundPic}
\section*{Something, some text}
%\restoregeometry

The result is this:

enter image description here

Top and bottom margins are 0, so it is OK, how can I get rid of the white lines just for this one page?

Thank you very much

4
  • 1
    You need to change the geometry if you want to keep keepaspectratio. If you drop that key, the picture will fill the full page but get "deformed". That is to say, either the paper geometry accidentally fits the dimensions of that graphics or you need to make some compromise.
    – user194703
    Mar 18 '20 at 11:59
  • @Schrödinger's cat , yes I already tried that, the picture unfortunately gets deformed, I was thinking if its possible to basically zoom in (i would sacrifice part of the image - top and bot, to keep the aspect ratio), do you know if this is possible? I mean is it possible in LaTeX? In case it is not possible I could just do some adjustments in Gimp and call it a day, but I do not think that is the best solution. Thank you very much
    – Raymond_90
    Mar 18 '20 at 12:10
  • \includegraphics[width=\paperwidth,keepaspectratio,clip]{img0016.png} This seems to kind of zoom in without distortion.
    – Raymond_90
    Mar 18 '20 at 12:21
  • Yes, that's another possibility, As the key clip indicates, it clips, i.e. truncates, the graphics.
    – user194703
    Mar 18 '20 at 12:23
1

\includegraphics[width=\paperwidth,keepaspectratio,clip]{img0016.png} Solved my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.