[Tex/LaTex] Dimension too large. error from pdflatex when using \includegraphics


I am getting the following error on few images being loaded by pdflatex. The images are in pdf files. MWE


pdflatex foo.tex gives

! Dimension too large.
<argument> \ht \@tempboxa 

l.7 ...,height=\textheight,keepaspectratio]{image}


The image.pdf is this link

It doe not matter if the image size specification is there or not, the error still shows up. i.e. \includegraphics[]{image} also generates the error.

The image pdf file has nothing in it. This is another issue. This image pdf file was created by Mathematica Export command. I was exporting a Mathematica image to pdf and it looks like Mathematica could not export the image to pdf file so it wrote an empty image pdf file. But the question is why pdflatex gives an error?

Is there a memory limit or some build in limit on size of pdf image files or dimensions?

I am using TL 2015 on linux mint 7.2

ps. Here is an example of pdf image file that is correctly read by pdflatex. It is not as large (and happened not to be empty as well).


fyi, Thanks to cfr comment in my other question How to check that image has valid size before `\includegraphics` is called? , using pdfinfo -box image.pdf gives

>pdfinfo -box image.pdf
Creator:        Wolfram Mathematica for Microsoft Windows (64-bit) (March 23, 2015) Student Edition - Personal Use Only
CreationDate:   Tue Jul 21 13:15:48 2015
ModDate:        Tue Jul 21 13:15:48 2015
Tagged:         no
Form:           none
Pages:          1
Encrypted:      no
Page size:      504 x 18988 pts
Page rot:       0
MediaBox:           0.00     0.00   504.00 18988.00
CropBox:            0.00     0.00   504.00 18988.00
BleedBox:           0.00     0.00   504.00 18988.00
TrimBox:            0.00     0.00   504.00 18988.00
ArtBox:             0.00     0.00   504.00 18988.00
File size:      337034 bytes
Optimized:      no
PDF version:    1.5

Best Answer

There's a limit for graphics dimensions, bounded above by \maxdimen (16384pt); in the case of the height for images, the limit is around 574cm to 576cm for some of the images I tested. For example,





triggers the error message, but using 575 there's no error (just the obvious warning about overfull \vbox)

Your image is almost 670cm high! (clearly higher than \maxdimen) so the error is triggered. Besides that, what would you do with such a large image compressed to fit into an a4paper document?