Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a ~259 MB PDF. I did pdf2ps and ps2pdf. The final size was 45 MB. I don't see any visible difference in quality in any reader. Although, the bookmarks were lost. I tried using pdftk, but it didn't preserve the bookmarks.

pdftk ... update_info

What caused the huge reduction in size? Is there an alternative to preserve the bookmarks and still have the reduced size (preferably linux command-line alternatives)?

share|improve this question

migrated from Aug 24 '12 at 21:43

This question came from our site for professional and enthusiast programmers.

Following up on @Dan's answer: different encodings (and compression) could explain the difference. As a simple test, look at the size of either file after compression with gzip. Is the size difference still impressive? – Henk Langeveld Aug 24 '12 at 22:39
up vote 15 down vote accepted

You can try ghostscript with ebook output and the bookmarks seems to be preserved:

gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dPDFSETTINGS=/ebook -sOutputFile=newFile.pdf originalFile.pdf
share|improve this answer
thanks it worked. I used the PDFSETTINGS=/screen. With that option the pdf became 15MB :) Ref: GS Tips – Vishnu Kumar Aug 25 '12 at 10:28
Forgot to mention, the bookmarks were indeed preserved. But still does anyone have clues on what is getting reduced? – Vishnu Kumar Sep 4 '12 at 8:12

@Vishnu Kumar

I'm glad you asked. Your question led me to re-examine this issue and I found out that I had extracted 100 pages from a 1000+ page PDF, using Acrobat Pro, as a test case, however that did not include the TOC bookmarks as I had assumed and that was the problem. So I opened the original large PDF in Acrobat Pro and deleted all but the first 100 pages and deleted all but the relevant bookmarks and saved that as my test case. Now the TOC is being preserved.

Here is my comparison of the two settings:

/ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.

gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dNOPAUSE -dBATCH -sOutputFile=reduced/output_1-102_TOC_[gs-ebook].pdf input_1-102_TOC.pdf

ridiculously slow
91.7MB-->33.4MB (36% of original)
TOC preserved
quality poor - pixellated

/printer selects output similar to the Acrobat Distiller "Print Optimized" setting.

gs -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dNOPAUSE -dBATCH -sOutputFile=reduced/output_1-102_TOC_[gs-printer].pdf input_1-102_TOC.pdf

91.7MB-->68.9MB (75% of original)
TOC preserved
quality almost identical

Other settings:

/default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file.

gs -sDEVICE=pdfwrite -dPDFSETTINGS=/default -dNOPAUSE -dBATCH -sOutputFile=reduced/output_1-102_TOC_[gs-default].pdf input_1-102_TOC.pdf

91.7MB-->60.8MB (66% of original)
TOC preserved
quality almost identical

/prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.

gs -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -dNOPAUSE -dBATCH -sOutputFile=reduced/output_1-102_TOC_[gs-prepress].pdf input_1-102_TOC.pdf

91.7MB-->80.2MB (87% of original)
TOC preserved
quality almost identical

As can be seen, the /default setting performed best, giving the smallest size for the best qualiy.

share|improve this answer

Ignore this and see update as a result of Vishnu Kumar's comment.

This did not work for me. Yes it reduced the size by half but with unacceptable pixellated fonts and no more bookmarks TOC, as with every other output setting I tried with gs, i.e., screen and printer. Thanks anyway…

share|improve this answer
Have you tried /ebook?? – Vishnu Kumar Sep 16 '14 at 11:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .