# Exclude everything from pdf document except images

is there any way to ONLY print out a pdf with all the image with the correct sizes as they appear in the single chapters/sections etc...? The reason is I want to only print out some pages (not the full article / thesis) containing only the images so that I can easily and cheap check wether the image quality is okay or not. Therefor, I don't need any tables, listings, TOC, the text etc... Thanks!

Edit: Embed code #1:

\begin{figure}[htb]
\includegraphics[width=\textwidth]{flow1.pdf}
\caption{blaaaa}
\label{fig:blaaa}
\end{figure}


Embed code #2:

\begin{figure}[htb]
\centering
\hfill
\subfloat[htb][asd]{\fcolorbox{plotBord}{plotPadd}{\includegraphics[scale=\scalefaktorDbl]{figs/asdasd.png}}\label{fig:LZKf1}}
\hfill
\subfloat[htb][asd234asd]{\fcolorbox{plotBord}{plotPadd}{\includegraphics[scale=\scalefaktorDbl]{figs/asdasd}}\label{fig:asd}}
\hfill\null
\caption{aasd}\label{fig:asd}
\end{figure}

-
are images inserted as floats? –  Herbert Jul 11 '11 at 20:29
There's a similar question here: How do you print only the pages with figures on them?. If this answers your question, we can close it as a duplicate. –  Alan Munn Jul 11 '11 at 20:37
@Herbert: What do you exactly mean? The insert codes are edited into the first post above! @Alan: I'll read it now! –  tim Jul 11 '11 at 20:44
I think How to retain figures only with captions in their original positions is what you need. It uses \usepackage[notext]{crop}. –  Martin Scharrer Jul 11 '11 at 20:47
@Marc: use package endfloat, it puts all figures and tables at the end of the document. Then you can easily print only the pages with the images. after having done, delete the package and you'll get the original paper. –  Herbert Jul 11 '11 at 20:49

## 2 Answers

You may try putting the following code, extracted from the package syntonly, just before \begin{document}

\usepackage{array}
\makeatletter
\font\dummyft@=dummy \relax
\dummyft@
\tracinglostchars=\z@
\count@\sixt@@n
\loop
\ifnum\count@ >\z@
\advance\count@\m@ne
\textfont\count@\dummyft@
\scriptfont\count@\dummyft@
\scriptscriptfont\count@\dummyft@
\repeat
\let\selectfont\relax
\let\mathversion\@gobble
\let\getanddefine@fonts\@gobbletwo
\pagestyle{empty}
\let\ps@fancy\ps@empty
\let\hline\relax
\newcolumntype{|}{}
\let\cleardoublepage\relax
\makeatother


This should ignore all text, but include images, printing as many as possible on each page.

I've added some of the more frequent commands that need to be "neutralized".

# Alternative approach

Add the following to the preamble:

\newwrite\figurewrite
\immediate\openout\figurewrite=\jobname-figures.tex
\let\includegraphicsORI\includegraphics
\renewcommand{\includegraphics}[2][]{%
\immediate\write\figurewrite{\unexpanded{\includegraphics[#1]{#2}}^^J}%
\includegraphicsORI[#1]{#2}}


Compiling your document (say thesis.tex ) will write a file thesis-figures.tex containing the relevant \includegraphics commands and it's just a matter of adding a suitable preamble in order to compile this file.

-
Doesn't work :( There are many empty pages, often the images are printed as only one on a page and further the horizontal line from the chapter-headlines remain... The table-lines also remain! –  tim Jul 11 '11 at 21:32
Can you provide your preamble? –  egreg Jul 11 '11 at 21:38
Thanks, the alternate way works. I'm getting one tex file which I can include testwise and print those pages out! –  tim Jul 12 '11 at 11:40
the alternative approach fails when the (yet uncommon) \includesvg is used (well, actually using the *-figures.tex file afterwards fails) –  stefanct Feb 21 at 13:02
\usepackage[active,floats]{preview}


in your document preamble should do the trick. That puts out all the complete figures. If what you are interested in are just the graphics inclusions, try

\usepackage[active,graphics]{preview}


instead. If you leave out the active option, your document will appear unchanged, but you can use something like

pdflatex -jobname mygraphics '\PassOptionsToPackage{active}{preview}\input{myfile}'


in order to generate mygraphics.pdf with the extracted previews from myfile.tex.

-
this seems to have problems with the document class memoir, or at least i think so: with my (memoir-based) thesis only the bottom half of the images are printed on the very top and one per page; some images are printed two times. –  stefanct Feb 21 at 13:06