# How to fix “Dimension too large” error when outputting large pdf file?

I have to create a pdf file with a lot of information.

This code:

\documentclass[border={0pt 850px 0pt 850px}]{standalone}
\usepackage{xcolor,pagecolor,lipsum,pbox,graphicx,anyfontsize}
\usepackage[utf8]{inputenc}
\usepackage[sfdefault,light]{roboto}
\usepackage[T1]{fontenc}

\graphicspath{./images/}

\begin{document}
\begin{minipage}[t]{1600px}

\pagecolor{black}
\color{white}

{\fontsize{16}{26}\selectfont

Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]

}%End fontsize

\end{minipage}

\end{document}

When I try to export the pdf file and have a lot of content, I get the following error:

! Dimension too large.
\height ->\ht \@tempboxa

l.35 \end{minipage}

So I tried to separate the content into several minipages (they are not perfectly below each other but for testing it's ok):

\documentclass[border={0pt 850px 0pt 850px}]{standalone}
\usepackage{xcolor,pagecolor,lipsum,pbox,graphicx,anyfontsize}
\usepackage[utf8]{inputenc}
\usepackage[sfdefault,light]{roboto}
\usepackage[T1]{fontenc}

\graphicspath{./images/}

\begin{document}
\begin{minipage}[t]{1600px}

\pagecolor{black}
\color{white}

{\fontsize{16}{26}\selectfont

Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]

}%End fontsize

\end{minipage}

\begin{minipage}[b]{1600px}

\pagecolor{black}
\color{white}

{\fontsize{16}{26}\selectfont

Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]
Test\\[50cm]

}%End fontsize

\end{minipage}

\end{document}

but then I get a more global error:

! Dimension too large.
\sa@placebox ...lobal \pdfpageheight =\ht \sa@box
\fi \global \paperwidth =\...
l.51 \end{document}

?

Is there any way to fix this without re-setting the sizes of the minipage, fonts, margins, etc.?

Maybe some way to set the dimensions of the resulting pdf file?

• You have a 6-meters-long document. Do you really need to have such a giant size? – user156344 Apr 6 at 7:09
• It's a very special use case. As it is a vector graphic I could simply reduce all the font sizes etc. but just telling the pdf converter to make a smaller pdf would be ok, too and far less complicated. – Julius S. Apr 6 at 7:11
• I get the error ! Improper \prevdepth from your first example – David Carlisle Apr 6 at 10:31
• I will add the missing \end to the question... – David Carlisle Apr 6 at 10:32