Page LayoutUsing a PDF as "background" on first page

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
jemostrom
Posts: 2
Joined: Mon Oct 26, 2015 11:58 am

Using a PDF as "background" on first page

Post by jemostrom »

For the last 10 years or so I’ve been using the same latex-template for creating exams (it’s part of a small script I have to create anonymized exams according to university rules). Anyway, a few weeks ago the university changed the rules for how the exams should look like and now the first page has to look in a certain way … which means exactly that way. They provide templates for Word but of course nothing for LaTeX.

So I first tried to create that front page in LaTeX directly but failed miserably (I don’t know much LaTeX) but I realized that there was a other solution that would mean less work for me: I made a PDF out of the front page, read it in my LaTeX-file and then wrote ID numbers and other info ”on top” of the PDF. This results in a front page that follows the rules.

However, to be able to place to PDF so it looked OK I needed to change the geometry from the standard size … but of course this messes up the page width on the rest of the exam which make it look horrible (lines are too long).

So I’m looking for advise on how to solve this. The first solution that come to my mind is ”change the geometry on the first page only” but unfortunately my LaTeX knowledge is too weak to figure out how to do this.

What I have is the following:

To change the geometry I use

Code: Select all

\geometry{a4paper,textwidth=17.5cm,textheight=26.5cm}
to place the front PDF I do the following (I came up with this after some book-reading, googling and testing):

Code: Select all

	\thispagestyle{empty}
	\setlength{\unitlength}{1cm}
	\begin{picture}(16.5,24.5)
		\put(-2.5,-4){\fbox{\includegraphics{kodblad.pdf}}}
		\put(12,23.5){\makebox(4,1){\large \studentKod}}
		\put(3,7){\makebox(10,1){\large \tentaNamn}}
	\end{picture}
	
	\newpage
My questions:

1 - Can I change the geometry on the first page only?
2 - Is that the best solution or is there a better way of doing this?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Using a PDF as "background" on first page

Post by Johannes_B »

Welcome,

You can use \newgeometry to change the geometry after the title.

It doesn't really matter what you use to put the information on the background, the picture environment is fine, you could do it as well with pgf or pstricks.

Cleanest solution would be to recreate the title page with LaTeX though ;-) This would also ensure the exact same fonts and font sizes.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
jemostrom
Posts: 2
Joined: Mon Oct 26, 2015 11:58 am

Re: Using a PDF as "background" on first page

Post by jemostrom »

Thanks, I'll will play around and see if I succeed.

I completely agree that it would be better with a native latex solution ... but the required page is sooooo ugly that I would hate myself if I spent time recreating it :lol:, not to mention that I suspect that the will change it now and then (we are talking about stuff from the administration!!! :mrgreen: ).
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Using a PDF as "background" on first page

Post by Stefan Kottwitz »

Hi jemostrom,

welcome to the forum!

You could use the background package. I made this example for my LaTeX Cookbook:

Code: Select all

\documentclass{article}
\usepackage{background}
\usepackage{blindtext}
\backgroundsetup{scale = 1, angle = 0, opacity = 0.2,
  contents = {\includegraphics[width = \paperwidth,
  height = \paperheight, keepaspectratio]
  {/usr/local/texlive/2014/texmf-dist/doc/latex/l2picfaq/ctanlion.pdf}}}
  % Adjust filename and path to match your own image 
\begin{document}
\Blinddocument
\end{document}
background.png
background.png (84.53 KiB) Viewed 11815 times
Stefan
LaTeX.org admin
Post Reply