Class COSWriterCompressionPool


  • public class COSWriterCompressionPool
    extends java.lang.Object
    An instance of this class compresses the contents of a given PDDocument.
    Author:
    Christian Appl
    • Field Detail

      • MINIMUM_SUPPORTED_VERSION

        public static final float MINIMUM_SUPPORTED_VERSION
        See Also:
        Constant Field Values
    • Constructor Detail

      • COSWriterCompressionPool

        public COSWriterCompressionPool​(PDDocument document,
                                        CompressParameters parameters)
                                 throws java.io.IOException

        Constructs an object that can be used to compress the contents of a given PDDocument. It provides the means to:

        Parameters:
        document - The document, that shall be compressed.
        parameters - The configuration of the compression operations, that shall be applied.
        Throws:
        java.io.IOException - Shall be thrown if a compression operation failed.
    • Method Detail

      • getTopLevelObjects

        public java.util.List<COSObjectKey> getTopLevelObjects()
        Returns all COSBases, that must be added to the document's top level container. Those objects are not valid to be added to an object stream.
        Returns:
        A list of all top level COSBases.
      • getObjectStreamObjects

        public java.util.List<COSObjectKey> getObjectStreamObjects()
        Returns all COSBases that can be appended to an object stream. This list is only provided to enable reflections. Contained objects should indeed be added to a compressed document via an object stream, as can be created via calling: createObjectStreams()
        Returns:
        A list of all COSBases, that can be added to an object stream.
      • contains

        public boolean contains​(COSBase object)
        Returns true, if the given COSBase is a registered object of this compression pool.
        Parameters:
        object - The object, that shall be checked.
        Returns:
        True, if the given COSBase is a registered object of this compression pool.
      • getHighestXRefObjectNumber

        public long getHighestXRefObjectNumber()
        Returns the highest object number, that is registered in this compression pool.
        Returns:
        The highest object number, that is registered in this compression pool.
      • createObjectStreams

        public java.util.List<COSWriterObjectStream> createObjectStreams()
        Creates COSWriterObjectStreams for all currently registered objects of this pool, that have been marked as fit for being compressed in this manner. Such object streams may be added to a PDF document and shall be declared in a document's PDFXRefStream accordingly. The objects contained in such a stream must not be added to the document separately.
        Returns:
        The created COSWriterObjectStreams for all currently registered compressible objects.