I'm trying to reduce the file size of a PDF using GhostScript. Generally, this works:
gswin32c -sDEVICE=pdfwrite -sOutputFile=out.pdf in.pdf
I think it gets rid of bookmarks, annotations, etc.
On some PDFs, I end up with a blank PDF. I get the following output:
GPL Ghostscript 9.04 (2011-08-05)
Copyright (C) 2011 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Error: /rangecheck in --run--
Operand stack:
15 0 15 --nostringval-- 15
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-
- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- fa
lse 1 %stopped_push 1926 1 3 %oparray_pop 1925 1 3 %oparray_
pop 1909 1 3 %oparray_pop --nostringval-- --nostringval-- --nostri
ngval-- --nostringval-- --nostringval-- --nostringval--
Dictionary stack:
--dict:1166/1684(ro)(G)-- --dict:1/20(G)-- --dict:82/200(L)-- --dict:82
/200(L)-- --dict:108/127(ro)(G)-- --dict:291/300(ro)(G)-- --dict:22/30(L)-
-
Current allocation mode is local
GPL Ghostscript 9.04: Unrecoverable error, exit code 1
The error message is not particularly helpful. Any suggestions how to troubleshoot this problem?