Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
850 views
in Technique[技术] by (71.8m points)

pdf - Any tips for speeding up GhostScript?

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...