45

My institution's letterhead is available as a PDF file. The PDF is not just of the logo (to be placed in a corner), but of the entire page. Is it possible to make this PDF the background of the first page of my document?

Vebjorn Ljosa
  • 22,437
  • 17
  • 43
  • 32

3 Answers3

55

You can accomplish this with the wallpaper package. It has many options for creating background images that are tiled, centered, and scaled, on every page or only specific ones. In your case if the letterhead is contained in lh.pdf then you simply need

\documentclass{article}
\usepackage{wallpaper}
\ULCornerWallPaper{1}{lh.pdf}
\begin{document}
  Your text on the letterhead
\end{document}

The key command in this case is of course \ULCornerWallPaper{<scale>}{<file>} that places the image contained in <file> in the upper-left corner, scaled by a factor of <scale>.

Michael Underwood
  • 21,356
  • 13
  • 52
  • 41
  • didn't he say he wants the entire page, rather than just the logo on the corner? – Vivi Aug 02 '10 at 19:34
  • 6
    Yes, but based on his description it sounded to me as if the file I called lh.pdf is the size of the entire page. So when it's placed in the upper-left corner, it covers the whole page... – Michael Underwood Aug 02 '10 at 19:59
  • 1
    Thank you Michael for sharing this. Your tip has been extremely useful for some documents that I had to deal with recently. – mfriedman Nov 05 '11 at 22:17
  • I have certain PDF's that when used as wallpaper in this way (or eos-pic way) produce final PDF files that can not be opened by Acrobat Reader (but can be opened with Evince). I didn't find the pattern for this problem, any ideas? – alfC Jan 10 '13 at 00:54
  • If your output pdf, produced after the use of the wallpaper package, can be opened by Evince but not with Acrobat Reader, you can fix it using ghostscriptL gs -o repaired.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress corrupted.pdf. You can find more details on the SuperUser site. –  Nov 21 '14 at 13:48
  • Let me add to suggestions that I needed for this to work for me. First, \ThisULCornerWallpaper with "This" added will put the letterhead only one one page - so if you only need the letterhead on page one add "This". Secondly, straight use with a large letterhead may cause overlap of the .tex output and the letterhead. To prevent this I pushed the start of the text down by using \null \vskip .75in – Barry Simon Jul 25 '16 at 20:21
10

The package eso-pic allows to include a background image at each page but also on a single page.

Another option is to use the textpos package that can put a box at a position on the page behind the text. It can be used together with \includegraphics and a PDF file.

Stefan Kottwitz
  • 231,401
9

Here is a example with eso-pic, that uses frontpage.pdf for the first page and normalBackground.pdf for the rest.

First create 2 macros that can be used later.

\usepackage{graphicx}
\usepackage{eso-pic}

\newcommand\BackgroundPicFront{ \put(0,0){% \parbox[b][\paperheight]{\paperwidth}{ \vfill \centering \includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{frontpage}% \vfill } } }

\newcommand\BackgroundPic{ \put(0,0){% \parbox[b][\paperheight]{\paperwidth}{ \vfill \centering \includegraphics[width=\paperwidth,height=\paperheight,keepaspectratio]{normalBackground}% \vfill } } }

Then use those macros and don't forget to "clear"/"remove" the first background when you add the next background.

% Sets the background
\AddToShipoutPicture{\BackgroundPicFront}

% Unsets the background \ClearShipoutPicture

% Sets another background \AddToShipoutPicture{\BackgroundPic}

Have fun

Niko Fohr
  • 744
  • 1
  • 7
  • 15
Johan
  • 2,204
  • Johan, it looks like the two \BackgroundPic* commands do exactly the same thing except that they use two different image files. Is there any reason why they couldn't be defined as LaTeX commands with an argument, so that there is only one new command needed? Also, am I correct that if, after the first page, plain paper is needed, then there is no need to call \AddToShipoutPicture{\BackgroundPic} after \ClearShipoutPicture? – Mars Mar 24 '19 at 03:05
  • Added a % after the \put(0,0){. The image was shifted a bit to the right without the %. – Niko Fohr Oct 30 '23 at 09:43
  • 1
    @Mars you're correct, if you want to just set one background, you don't have to call \AddToShipoutPicture{\BackgroundPic} after the \ClearShipoutPicture – Niko Fohr Oct 30 '23 at 09:44