0

I am compressing large PDF files (+10 MB in size) with GS using the following snippet:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=shrink.pdf large_2.pdf

The problem is it took around 5 - 10 minutes to compress a 35MB file to 10 MB's.

Is this normal? I have an average machine, quad core - however I'm worried it'll be slow on the server as well. Is this fixed when I put it on a more powerful server?

The pdf I'm running compression on is National Aeronautics and Space Administration FY 2014 PRESIDENT’S BUDGET REQUEST SUMMARY (34 MB)

  • I compressed the same file on my system and it took 49.401 seconds to complete (I used the time command to get this value). Also, for the record I have an Intel i5-4690k Quad-Core clocked at 3.9 GHz but it never maxed out more than one core at a time. Additionally, my memory is also clocked at 1600MHz which may make a difference to the compression time albeit minimally and it definitely shouldn't take 5-10 minutes to complete. – Michael Lindman Jun 26 '15 at 16:32
  • 1:48 minutes on a Core2 Duo @ 3.00GHz. Are there some other processes using a lot CPU or IO time? – Florian Diesch Jun 26 '15 at 16:56
  • 1:03 on i7-3770K with openSUSE, but the resulting file was 8MB...and I got some warnings (No Incltree created, No imsbtree created). It might also be related to the gs version. – Bruni Jun 27 '15 at 6:19
0

I compressed the same file on my main Ubuntu desktop (15.04) and it took 49.401 seconds to complete. The machine has an Intel i5-4690k Quad-Core clocked at 3.9 GHz and 12GBs of Memory clocked at 1600MHz. During the compression it never maxed out more than one core and only ever used two cores at any given time.

For comparison I also ran it on my Mini-ITX machine (Ubuntu Server 15.04) and it took 3 minutes and 16.050 seconds to compress the file. This machine has an Intel J1800 Dual-Core Processor clocked at 2.41GHz and 4GBs of Memory clocked at 1333MHz.

Below is the output I got from running the time command in front of the gs command:

Ubuntu Desktop

real    0m49.401s
user    0m49.084s
sys     0m0.208s

Mini-ITX Machine

real    3m16.050s
user    3m14.684s
sys     0m0.924s

All of this suggests that a more powerful processor definitely makes a difference to the compression time but given that only two cores were used on my desktop machine I'd say clock speed is much more important to the compression time than number of cores but without knowing the exactly model of processor it is hard verity this against your setup.

| improve this answer | |
0

I used below commands but it didnt compress my pdf file substantially. Some times some of the portion was blackened after compression.

  1. gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf $INPUTFILE

  2. "ps2pdf -dPDFSETTINGS=/ebook %s %s" % (input_file_path, out_file_path)

After too much wandering over the web I just couldn't find the right compression library. I came across pdfcompressor.com. This is just awesome website. It compresses the pdf by 95% ( 15Mb of files). So I used selenium and Tor to automate the compression. Checkout my Github Repository. [GITHUB] (https://github.com/gugli28/PdfCompressor)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.