# Memoir showtrims breaks auto-pst-pdf

I have set of large documents that need to go to printers and I want to show the trim edges. I'm using a large number of pstricks images in the documents (these are science and maths textbooks) so I'm using auto-pst-pdf with pdflatex -shell-escape.

My problem is, when I enable showtrims as shown below, the ghostscript step fails and I don't get the PDF file with the images. If I remove showtrims it works but of course the trim marks doesn't appear.

Is there a way around this besides using xelatex? I can use that option but the books take forever to compile.

\documentclass[11pt, a4paper, openright, showtrims]{memoir}

\usepackage{pst-all}
\usepackage{auto-pst-pdf}
\usepackage{lipsum}

% Custom stock paper and page size
\setstocksize{317mm}{230mm}
\settrimmedsize{297mm}{210mm}{*}
\setlength{\trimedge}{\stockwidth}
\setlength{\trimtop}{\stockheight}
\settrims{0.5\trimtop}{0.5\trimedge}
% set some lengths
\setlength{\sidebarhsep}{1cm}
\setlength{\sidebarwidth}{3.5cm}
\setulmarginsandblock{3\baselineskip}{4\baselineskip}{*}
\setlrmarginsandblock{2cm}{5cm}{*}
\setlength{\footskip}{2\baselineskip}
\checkandfixthelayout

\begin{document}
\lipsum[1]

\begin{pspicture}
(1.5,-.5)(8.5,2)
\psline{->}(2,1)(8,1)
\rput[l](2,0){Tail}\psline{->}(2.3,.3)(2,.9)
\rput(5,1.5){Magnitude}
\psline{|-|}(2,1.3)(8,1.3)
\end{pspicture}

\lipsum[2]

\end{document}

-

The workaround I'm using at the moment is to disable the display of the trim marks on the first compile. This will create the auxiliary pdf file containing the images. Then, I enable showtrims and use \usepackage[off]{auto-pst-pdf} which will skip the creation of the image pdf and avoid the ghostscript crash.