# ps2pdf -dEPSCrop input.eps cannot crop input with \pagecolor{<non-white>}

If I set \pagecolor{} to any color other than white, I will get a strange result.

rem batch.bat takes a file name without extension.
latex -interaction=nonstopmode %1
dvips -E %1 -o %1-temp.eps
epstool --copy --bbox %1-temp.eps %1.eps
ps2pdf -dEPSCrop %1.eps

\documentclass{minimal}
\usepackage{pstricks}
\pagecolor{red}% please try white or disable it.
\begin{document}
\begin{pspicture}[showgrid=true](2,2)
\psframe(2,2)
\end{pspicture}
\end{document}


Is it a bug?

-

No, this is not a bug in ps2pdf.
ps2pdf -dEPSCrop takes the boundingbox from the eps file. Here, epstool has put a very large bounding box in the file. epstool --copy --bbox uses the ghostscript bbox device to calculate the bounding box, and you already know that this has a problem in recent versions of ghostscript when there is a coloured background (whether you want to call this a "bug" in ghostscript is debatable).