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?
3 Answers
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>.
- 21,356
- 13
- 52
- 41
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.
- 231,401
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
-
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
eos-picway) 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:54wallpaperpackage, can be opened by Evince but not with Acrobat Reader, you can fix it using ghostscriptLgs -o repaired.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress corrupted.pdf. You can find more details on the SuperUser site. – Nov 21 '14 at 13:48