Mobileread
Pdf compression options in Ghostscript?
#1  MarjaE 06-14-2019, 09:25 PM
Hi,

I am looking for options to speed up my pdfs so they load faster on the Kindle Dx and never crash it. I already convert to version 1.4, either using Ghostscript or Willus' k2pdfopt.

I am trying to optimize for compatibility, and then speed, not file size, so jpeg-2000 is not an option.

1. Conversion with Compression, older system

I used to use the following to pre-process some pdfs for older Kindle compatibility. I mostly ran it in Apple's Automator for drag-and-drop w/o extra typing, but that requires different syntax. It had the side effect of compressing images, and sometimes obscuring pages which had been wrong rendered as images:

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

I think I can get milder compression with:

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

based on these instructions, but reversing the polarity: http://www.spoonylife.org/level-3/converting-a-pdf-from-version-1-4-to-1-5-1-6-etc

2. Conversion without Compression

I currently use the following. I mostly run it in Apple's Automator for the same reason, but that requires different syntax. It avoids obscuring pages, but it sometimes leaves a lot of large images which slow down, freeze, or even crash my Kindle Dx:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

3. Text-Only, unreliable

I also experimented with variations on the following, but it would lose scale on pages and lose real text as well as images:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dFILTERIMAGE -dFILTERVECTOR -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

4. Conversion with compression, is there a new system?

Current Ghostscript documentation such as "How to use Ghostscript" avoids mentioning -dPDFSETTINGS or listing the options:

https://www.ghostscript.com/doc/current/Use.htm

But they do mention the extremely buggy and even more aggressive -dFILTERIMAGE and -dFILTERVECTOR, so is there some problem with -dPDFSETTINGS where they want to discourage use short of dropping the function...?

And is there another option replacing -dPDFSETTINGS?
Reply 

#2  MarjaE 06-15-2019, 01:44 PM
I'm getting crashes on =ebook so I guess it's better to go back to =screen, unless anyone knows of better compression options...?
Reply 

Today's Posts | Search this Thread | Login | Register