Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've got a LaTeX document, and I've been given a PNG file consisting of a page border with a big transparent section in the middle.

Is it possible to use LaTeX to add that image to every page, with the actual content in the transparent section; or will I have to create the PDF with LaTeX and then manually add the border in some other way?

share|improve this question

1 Answer

up vote 6 down vote accepted

One option would be to use the background package to place the image as a background image; the geometry package can be used to adjust the text area. A little example:

\documentclass{article}
\usepackage[tmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm,bmargin=2.5cm]{geometry}
\usepackage{graphicx}
\usepackage{background}
\usepackage{fourier}
\usepackage{lipsum}

\backgroundsetup{scale=1,angle=0,opacity=1,contents={\includegraphics[scale=1]{border}}}

\begin{document}
\lipsum[1-20]
\end{document}

An image of the first page of the resulting document:

enter image description here

Here's the code I used toproduce the border used:

\documentclass{article}
\usepackage[dvipsnames]{xcolor} 
\usepackage[object=vectorian]{pgfornament}
\usetikzlibrary{calc}

\definecolor{mycolor}{cmyk}{0,0,0.1,0}

\pagestyle{empty}
\begin{document}
\color{mycolor}
\begin{tikzpicture}[remember picture,overlay] 
\coordinate (a) at ( $ (current page.north west) +  (1cm,-1cm)$); 
\coordinate (b) at ( $ (current page.south west) +  (1cm,1cm)$); 
\coordinate (c) at ( $ (current page.south east) +  (-1cm,1cm)$); 
\coordinate (d) at ( $ (current page.north east) +  (-1cm,-1cm)$); 
\fill[Maroon] (current page.south west) rectangle ( $ (current page.north west) + (2cm,0) $);
\fill[Maroon] (current page.south east) rectangle ( $ (current page.north east) + (-2cm,0) $);
\fill[Maroon] (current page.north west) rectangle ( $ (current page.north east) + (0,-2cm) $);
\fill[Maroon] (current page.south west) rectangle ( $ (current page.south east) + (0,2cm) $);
\pgfornamenthline{a}{d}{north}{87}
\pgfornamenthline{b}{c}{south}{87}
\pgfornamentvline{a}{b}{west}{87}
\pgfornamentvline{c}{d}{east}{87} 
\end{tikzpicture}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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