# How to define a custom PDF page size without margins and header/footer? KOMAscript

I want to create a PDF file with pdflatex which

• has a custom page size: \pdfpagewidth=680.6pt \pdfpageheight=441.0pt and
• which will be used completely for typesetting (no margins, no header or footer!)
• which is based on the scrbook class

It seems that the geometry package might do what I want, but I did not get there yet. Can somebody help?

Why?
I want to set the page size to the textheight and textwidth of my main document (thesis) and then create separately some very large longtables which I want to include pagewise with includegraphics in the main document.

Remark: For easier editing of the tables, I want to be the created PDF in landscape format, so each page will have to be rotated to fit in the main document. I hope this won't pose any problems. One difficulty I see is the space for the caption on the first page of each table.

If you have further ideas, what might go wrong or which difficulty I might have overlooked, with my plan, please tell me.

-
One idea would be to bring longtable to wrap each generated table page in a preview environment. This cuts down the page size automatically if the tightpage option is used. –  Martin Scharrer Jul 3 '11 at 22:56
@Martin Scharrer: thanks for your comment! I'm not familiar with the preview package. What would be the advantage compared to just adding each page of the pdf with includegraphics to the main document? –  Martin Jul 3 '11 at 23:02
No, that was meant to crop the pages of the longtable to your the \textwidth and \textheight as you wanted. Anyway, forget about that crazy idea. It turned out that setting the right geometry options is way easier. –  Martin Scharrer Jul 3 '11 at 23:25

The following geometry options seem to do what you requested (see the manual for more information). I added some test output as well. Note that \hbox{\rule{680.6pt}{441.0pt}} doesn't cause an overfull hbox warning and fills one page nicely.

\documentclass{scrbook}
\usepackage{longtable}

\pagestyle{empty}
\parindent=0pt
\begin{document}

textwidth=\the\textwidth

textheight=\the\textheight

pdfpagewidth=\the\pdfpagewidth

pdfpageheight=\the\pdfpageheight

\newpage\hbox{\rule{680.6pt}{441.0pt}}\newpage

\def\stuff{long & long & long \noexpand\noexpand\noexpand\\}
\edef\stuff{\stuff\stuff\stuff\stuff\stuff\stuff\stuff\stuff\stuff\stuff}
\edef\stuff{\stuff\stuff\stuff\stuff\stuff\stuff\stuff\stuff\stuff\stuff}

\begin{longtable}{ccc}
\stuff
\end{longtable}

\end{document}


To fit the caption in you could use \enlargethispage{<length>}, where I would goes something from \baselineskip to 2\baselineskip as a good length. Just watch for overfull warnings to see how much you must add. Note that this doesn't make it look better, just makes it fit!

-
thanks for your help and for the example! However, for the caption I'm not sure if \enlargethispage will help, as the tables are landscape format, so it is the \textwidth of the page affected and not the height. I could add a \rule of width 0pt above each longtable, but then I would have the white space above my table.. –  Martin Jul 3 '11 at 23:45
@Martin: How do you create the landscape pages? \enlargethispage should be fine with most ways. One other way would be to place the caption using TikZ (see e.g. tex.stackexchange.com/questions/14512/… for ideas) or the textpos package. –  Martin Scharrer Jul 3 '11 at 23:47
Scharrer: I'm currently experimenting, how to typeset the landscape pages in my thesis. I think this has to be discussed elsewhere: tex.stackexchange.com/questions/22239/… –  Martin Jul 4 '11 at 0:32