How to compress PDF in a whole?

Question: I'm working on a tool that will be writing PDF and am trying to find a way to compress the objects and streams in the PDF. A number of the PDF that I'm generating are fairly large, but can be substantially reduced by compressing the objects (or most of the PDF structure) into a flat stream. I swear I've seen this done before, but none of the PDF that I've looked at seem to do it. I also tried using Acrobat X to compress it with "entire file compression", but it seems to only compress the streams. I've tried using ObjStm, but it doesn't have a lot of support from other file readers. I hope I can find solution on VeryDOC.

Answer:In PDF you can have 2 types of compression:

  1. stream compression - the data is compressed using various methods, but the PDF file structure is not compressed.
  2. object compression - you also compress the file structure, mainly the objects that do not include streams.

These are the only supported compression scenarios in PDF. Selecting the right compression method depends much on the data you want to compress: for page content streams usually Flate compression is used, 1bpp images use CCITT G4 or better JBIG2, color images are better compressed with JPEG2000, etc. 

And there is one software on VeryDOC, maybe you can have a try: VeryDOC PDF Compressor. By this software, you can reduce PDF file size up to 40-95% by optimization technology for PDF file compression. It optimizes PDF structures and compresses pictures, graphics and objects within a PDF file while preserving the original file format and quality.  This software will compress stream and objects automatically.

Meanwhile, there is also command line version, server version and SDK version for you to choose.By the SDK version, you can   custom applications (majority of programming languages are supported: C#, C++, Delphi, Visual BASIC, VB.net, etc)

Now let us check some of parameters of this software, maybe you can feel some compress method this software uses.
-mi <string> : Set Monochrome Image Compression, values: jbig2, jbig2l, fax, zip, rle
-midown : Downsample Monochrome images
-midownres <int> : Set Monochrome Image Resolution
-midowntype <int>: Downsample type for Monochrome images:
    -midowntype 0: default
    -midowntype 1: Subsample
    -midowntype 2: Average
    -midowntype 3: Bicubic
-owner <string>: Owner password to use for encrypting output PDF file
-user <string> : User password to use for encrypting output PDF file
-perms <int>   : PDF security permissions to use for encrypting output file
-keylen <int>  : Defines the length (in bits) of the encryption key.
-winfont       : Use Windows fonts to replace Base14 fonts
-embedallfonts : Embed all fonts
-subsetfonts   : Subset fonts
-compressfonts : Compress fonts
-pwdinpdf <string> : Open password for input PDF file
-pdfa          : Create PDF/A file
-nobookmarks   : Don't generate bookmarks in output PDF file
-jbig2 : Compress monochrome image streams with JBIG2 arithmetic
-jpx   : Compress color and grayscale image streams with JPEG2000 arithmetic
-jpxquality <string> : Set Quality for JPX Compression, from 0.0 to 100.0, default is 0.5

If you need to know more about this software, please go to software homepage. During the using, if you have any question, please contact us as soon as possible.

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!