Search code examples
pdfghostscriptpostscripteps

Ghostscript hangs when converting PDF to EPS


I've been converting PDF files to EPS with Ghostscript for a long time but now I'm receiving CMYK PDF files generated with PDFsharp that when trying to convert them to a CMYK EPS Ghostscript just hangs forever, I don't get any errors or message so I don't really know what's happening.

The PDF file I'm trying to convert is this one, it opens just fine in AI, Photoshop, Chrome, and Foxit Reader so I think the PDF is not corrupt or malformed.

I tried Ghostscript 9.52 and 9.23 on Windows with this command:

gswin32c -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=eps2write -sOutputFile="out.eps" in.pdf

After adding the -dDEBUG flag I can see the process is getting stuck here:

enter image description here

Is there any way to know why it's getting stuck or what object in the PDF is causing it? Any information is greatly appreciated!


Solution

  • -r72 completes very quickly, and produces a 20MB file. -r300 completes in a minute or two and produces a file 300MB. By inference, at 720 dpi the output file will be about 1.7GB.

    If I run at normal resolution but add -dNOTRANSPARENCY (so that transparency is ignored) then I get a 27MB EPS file in a few seconds.

    Given that your file has media 40x60 inches, it's going to take a long time to render at 720 dpi. And when you do you're going to end up with an EPS which is nothing more than a monster image.

    It's up to you how to proceed; if the file genuinely uses PDF transparency then you cannot produce a vector representation in PostScript, because PostScript doesn't support PDF transparency, so an image is what you are going to get.

    You can choose to ignore transparency (with the possibility that the EPS will then not be the same as the PDF when rendered), or run at a lower resolution. I can't recommend a resolution without knowing the final print resolution, but 720 dpi is almost certainly unreasonably high.

    Note this isn't because it's a CMYK file, it's because the PDF uses transparency.