I have a 100 page PDF that is about 50 MBs. I am running the script below against it and it's taking about 23 seconds per page. The PDF is a scan of a paper document.
gswin32.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.3
-dPDFSETTINGS=/screen -sOutputFile=out4.pdf 09.pdf
Is there anything I can do to speed this up? I've determined that the -dPDFSettings=/screen
is what is making it so slow, but i'm not getting good compression without it...
UPDATE:
OK I tried updating it to what I have below. Am i using the -c 30000000 setvmthreshold
portion correctly?
gswin32.exe -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.3
-dPDFSETTINGS=/screen -dNumRenderingThreads=2 -sOutputFile=out7.pdf
-c 30000000 setvmthreshold -f 09.pdf
If you are on a multicore system, make it use multiple CPU cores with:
-dNumRenderingThreads=<number of cpus>
Let it use up to 30mb of RAM:
-c "30000000 setvmthreshold"
Try disabling the garbage collector:
-dNOGC
Fore more details, see Improving Performance
section from Ghoscript docs.