# Full page image as title page

## Background

Wrote a technical manual in LyX. The technical manual currently has two parts:

• Cover image (PDF)
• Manual text (PDF)

## Problem

When merging the two PDF files (with GhostScript or other software tools), there are a number of issues:

• Bookmarks (lost in merging)
• Colours (obvious changes)
• PDF tags (lost in merging)

I would rather include the cover page image as a full page (no margins) at the start of the manual and have LyX (LaTeX) generate the front page when it creates the PDF. In this fashion, the cover page and the manual text need not be merged as a separate step.

## Question

How do you instruct LaTeX to generate a full page image as the first page in a PDF using KOMA-Script?

## Update

Using the pdfpages package produces the following result:

Note the white space above and below the image. The white space is removed using the following:

\includepdf[fitpaper]{cover}


## Update

Part of the preamble contains:

% Resize figures that are too wide for the page.
\let\oldincludegraphics\includegraphics
\renewcommand\includegraphics[2][]{%
\graphicsformat{%
\oldincludegraphics[width=\ScaleIfNeeded,#1]{#2}%
}%
}


The full preamble is at: http://pastebin.com/qHKEDPeU

The error message is:

!pdfTeX error: pdflatex (file cover.pdf): cannot find image file


The file ch_02.lyx and test.latex are in the same directory. The file test.latex is the document in Martin's post. The file test.latex can find the file cover.pdf, yet the file ch_02.lyx cannot find the file. Both use the following code:

\includepdf[fitpaper]{cover.pdf}


## Update

The most minimal LyX example that produces the problem:

#LyX 1.6.7 created this file. For more info see http://www.lyx.org/
\lyxformat 345
\begin_document
\textclass scrbook
\begin_preamble
\usepackage{pdfpages}
\end_preamble
\use_default_options false
\language english
\inputencoding utf8
\font_roman lmodern
\font_sans helvet
\font_typewriter courier
\font_default_family default
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100

\graphics default
\float_placement H
\paperfontsize default
\spacing single
\use_hyperref true
\pdf_bookmarks true
\pdf_bookmarksnumbered false
\pdf_bookmarksopen false
\pdf_bookmarksopenlevel 1
\pdf_pdfborder false
\pdf_backref false
\pdf_pdfusetitle true
\papersize letterpaper
\use_geometry false
\use_amsmath 2
\use_esint 1
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\bullet 0 5 11 -1
\bullet 1 5 24 -1
\bullet 2 0 0 -1
\tracking_changes false
\output_changes false
\author ""
\author ""

\begin_body

\begin_layout Standard
\begin_inset ERT
status collapsed

\begin_layout Plain Layout

\backslash
includepdf[fitpaper]{cover.pdf}
\end_layout

\end_inset

\end_layout

\begin_layout Standard
Test
\end_layout

\end_body
\end_document


Thank you!

-
Your code should still use the optional argument. At the moment it is discarded: \renewcommand\includegraphics[2][]{% \graphicsformat{% \oldincludegraphics[width=\ScaleIfNeeded,#1]{#2}% }% } –  Martin Scharrer Apr 1 '11 at 9:47

You can use the pdfpages packages (not to be confused with pgfpages) to include a PDF image/page as single page(s) to your document. This is useful for appendices or cover pages. Depending on your needs you should make sure that the page numbers are not counted for the cover page and the white filler page after it.

\documentclass{scrbook}

\usepackage{pdfpages}

\begin{document}
\includepdf{cover}
\cleardoublepage
\frontmatter
\tableofcontents
\mainmatter
\chapter{A}
...
\chapter{B}
...
\end{document}


### Update:

As Bruno already commented, the fitpaper option of the pdfpages package will fit the page size of the first page to the size of the cover, removing excess white space. The option can be used as part of the \includepdf[<options>]{<file>} command.

This is fine for screen view, but for print-outs you should ensure that the cover and the normal pages have the same size from the beginning, either by recreating the cover with a larger height or by reducing the document size.

-
Just a little addendum: I've also used pdfpages and found the fitpaper option quite useful. –  Bruno Apr 1 '11 at 8:31
Perhaps you didn't start pdflatex in this directory. Or the name isn't actually cover.pdf but contains e.g. a space. –  Ulrike Fischer Apr 1 '11 at 8:52
@Dave: It should work. Try running kpsewhich cover.pdf in the document folder and see if it finds the file. Try it with a different file name. –  Martin Scharrer Apr 1 '11 at 8:54
@Dave: Try it with a minimal test file and see if it works. Maybe some other package causes this. –  Martin Scharrer Apr 1 '11 at 9:13
@Dave: Your redefinition is most likely causing it. Include the cover as follows: {\let\includegraphics\oldincludegraphics\includepdf[fitpaper]{cover}}. –  Martin Scharrer Apr 1 '11 at 9:44

## Solution

The following code inserts the cover as expected, within LyX:

\thispagestyle{empty}
\begin{tikzpicture}[remember picture, overlay]
\node[inner sep=0pt] at (current page.center) {%
\includegraphics[width=\paperwidth,height=\paperheight]{cover}%
};
\end{tikzpicture}
\cleardoublepage{}


## Problems

Martin's solution works in a simple case, for a simple LaTeX document. Due to what appears to be a bug in LyX, the LyX software is unable to directly export a simple document to a TeX document, and then into a PDF document. Trying to work around the bug by exporting to TeX and then running pdflatex manually results in a cover page that consists of an extremely small rectangle.

The given solution uses tikz to centre the image on the page.