# [OS X TeX] 'Too many open files' error with pdftex

Maarten Sneep maarten.sneep at xs4all.nl
Fri Nov 23 04:04:36 EST 2007

Kevin Walker schreef:
> When I run pdtex on a file with a large number of PNG figures, I get
> a 'Too many open files' error.  Looking through the archives for this
> list, I found the following work-around:
>
>    \let\mypdfximage\pdfximage
>    \protected\def\pdfximage{\immediate\mypdfximage}
>
> BUT: using the above trick doubles the size of my (already too large)
> output PDF file.  Presumably all the graphic files are being included
> twice.

I'm not sure that the graphic files are actually included twice, but some
optimization is left out when using this trick, that's for sure.

Have you tried to compress the pdf file with pdftk [1]? It should pick up
on the duplicate information, and reduce the file-size. You may need to
uncompress the file first.

Best,

Maarten

[1] http://www.accesspdf.com/pdftk/
If you need to build it yourself (I haven't tested it on Leopard so far,
but you may need to build pdftk yourself), you can get the required gcc
toolkit (including fortran and gcj) from http://hpc.sourceforge.net/