Skip to main content
Version: 1.5

Compress and optimize PDF documents

The Pdftools SDK lets you optimize PDF documents to suit specific target needs such as electronic document exchange, archiving, or printing.

Many processes produce PDF documents that may not be optimized for their specific target application. For example, the file size may deteriorate download times, or the same font embedded multiple times may impede printing. With the Pdftools SDK, you can easily configure the process through optimization profiles and determine specific output through various configuration options.

The Pdftools SDK reads an input document and writes the corresponding output document. Depending on the configured optimization options, various parts of the PDF are processed as required. The SDK is capable of removing redundant or alternative information, sub­setting and merging font programs, downsampling images, and intelligently choosing optimal compression algorithms.

Depending on the desired output, you can compress and optimize images, fonts, page content and document structure.

You can set the minimum PDF version of the output file. You can get a log report on the PDF file, listing fonts and images and their respective properties, and extract the number of pages.

Compress and optimize images

Images can increase file size significantly. The Pdftools SDK optimizes image objects, letting you configure image compression by image type, choose the compression algorithm and compression quality, set color management options such as color profiles and color channels, and convert or remove image objects partially or completely.

Compression process

  • Separately configure compression of bitonal, indexed, and continuous (i.e. color and grayscale) images
  • Define threshold in dots per inch (DPI) for triggering image downsampling
  • Define target image resolution in DPI for image downsampling
  • Automatically select best compression type for each image
  • Configure enforcement of configured compression types

Image object handling

  • Perform mixed raster content (MRC) optimization for images
  • Convert soft masks to image masks if applicable
  • Remove invisible parts of images
  • Remove images entirely and substitute by empty XObjects

Color management

  • Choose color management engine
  • Reduce the number of color channels used for images, image masks, and soft masks, if applicable
  • Convert colors to CMYK, RGB, or grayscale

Optimize fonts

If your PDF documents do not need to be edited, then there is no need to embed a font as a binary stream in the PDF document. You can subset font programs, removing all unused glyphs that are not needed to reproduce the document. You can determine when to remove standard fonts and when to merge fonts and font programs.

  • Subset font programs to contain only the used glyphs
  • Merge compatible font programs and fonts
  • Compress Type 1 fonts (convert to CFF)
  • Remove font programs

Compress and optimize content and structure

Unnecessary objects increase file size without reason. With the Pdftools SDK, you can remove these unused, redundant and unwanted objects to reduce file size and speed up rendering.

  • Remove unused resources
  • Optimize page content automatically
  • Flatten or remove page annotations and form fields
  • Remove unecessary data:
    • Redundant objects
    • Embedded standard fonts (e.g. Courier, Arial, Times)
    • Embedded, non-symbolic fonts
    • Unnecessary file information
    • Article threads
    • Alternative images
    • Metadata
    • Page-piece information
    • Output intent
    • Signature appearances
    • Document structure tree, including markup
    • Miniature page preview images
    • Spider (web capture) information
Get started

Learn how to optimize a PDF document for a specific use.