Loading...
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

To reduce the size of PDF documents when saving them, you can use severa flags within the PDDocSaveParams element, as part of elements saveFlags and saveFlags2.These flags are passed to the PDDocSaveWithParams() API call.

See the discussion of the PDF Optimizer, related to the Adobe PDF Library. The same utility is provided for both the Core Library and for the Java and Microsoft .NET Interfaces.

saveFlags:

  • PDSaveFull: Causes the PDF file to be fully written. Incrementally saved versions of the PDF document are discarded and the PDF to only contains the most recent contents. Do not use if you want to preserve previous revisions of the PDF file.
  • PDSaveCollectGarbage: Causes objects in the PDF that are unreferenced to be discarded.

saveFlags2:

  • PDSaveCompressed: Allows for PDF object compression and collections to be used. When this flag is set, the PDF can contain sets of compressed objects that are unpacked into their respective PDF objects when the PDF document is opened.
  • PDSaveRemoveASCIIFilters: Allows for ASCII85 filters to be removed from the PDF document. This change can allow for some streams to contain binary (non-ASCII) data, reducing the file size. But with this flag set the PDF document will not be able to be transmitted through channels that do not properly handle binary data. This is unlikely to be a problem; the common FTP and HTTP transfer protocols will work fine. Protocols that have problems with binary data are obscure and rarely used any longer.
  • PDSaveAddFlate: Compresses PDF streams with no compression using the Flate algorithm, except for metadata streams, which are left uncompresed.
  • PDSaveReplaceLZW: Causes LZW-compressed PDF streams to be re-compressed with Flate. This can save some space in most cases.
  • PDSaveOptimizeXObjects: Causes the Adobe PDF Library to search for identical forms and images and to reconcile these to references to a single form or image instead of references to the multiple, identical forms or images. This can involve substantial overhead during saving.

Other flags to consider.

saveFlags:

  • PDSaveLinearized: This flag optimizes the PDF for fast web viewing and random accesses of pages. Linearizing a PDF document places heavy demands on the local workstation’s memory and processor capacity, however, because all of the PDF objects in the saved file must be examined and potentially reordered. Use this flag with your application only if creating Linearized PDF documents is important enough that you can live with the memory and processor requirements.
      A linearized PDF document is processed in a way that allows for more efficient display of long PDF documents. A linearized PDF is restructured in a way that allows the first page of the file to appear on a user’s web browser while the rest of the file is being downloaded. This type of PDF document can thus display more quickly on a web page; the user does not need to wait for the entire document appear before he or she can start reading it. This is also known as web optimization.

 saveFlags2:

  • PDSaveOptimizeContentStreams: Attempts to consolidate common preambles between content streams when saving PDF files. These are not found very often.
  • PDSaveOptimizeFonts: Consolidates duplicated fonts and font subsets into references to one unified font. This can involve substantial memory and CPU overhead, however. It is also appropriate for PDF files created from merging many different PDF files into a single document, or PDF files created by merging pages from several different PDF files.
  • PDSaveOptimizeMarkedJBIG2Dictionaries: Consolidate out unused symbols from JBIG2-encoded datastreams in the PDF file. This is rarely used.
  • No labels