Class PDFDecoder

java.lang.Object
org.openpdf.renderer.decode.PDFDecoder

public class PDFDecoder extends Object
A PDF Decoder encapsulates all the methods of decoding a stream of bytes based on all the various encoding methods.

You should use the decodeStream() method of this object rather than using any of the decoders directly.

  • Field Details

    • DCT_FILTERS

      public static final Set<String> DCT_FILTERS
  • Constructor Details

    • PDFDecoder

      private PDFDecoder()
      Creates a new instance of PDFDecoder
  • Method Details

    • isLastFilter

      public static boolean isLastFilter(PDFObject dict, Set<String> filters) throws IOException
      Throws:
      IOException
    • decodeStream

      public static ByteBuffer decodeStream(PDFObject dict, ByteBuffer streamBuf, Set<String> filterLimits) throws IOException
      decode a byte[] stream using the filters specified in the object's dictionary (passed as argument 1).
      Parameters:
      dict - the dictionary associated with the stream
      streamBuf - the data in the stream, as a byte buffer
      Throws:
      IOException
    • getCryptFilterName

      private static String getCryptFilterName(PDFObject param) throws IOException
      The name of the Crypt filter to apply
      Parameters:
      param - the parameters to the Crypt filter
      Returns:
      the name of the crypt filter to apply
      Throws:
      IOException - if there's a problem reading the objects
    • isEncrypted

      public static boolean isEncrypted(PDFObject dict) throws IOException
      Determines whether a stream is encrypted or not; note that encodings (e.g., Flate, LZW) are not considered encryptions.
      Parameters:
      dict - the stream dictionary
      Returns:
      whether the stream is encrypted
      Throws:
      IOException - if the stream dictionary can't be read