Stream Filters
PDF Stream Filters
PDF streams use filters to encode data (ISO 32000-1:2008, §7.4). Filters are applied in sequence and identified by filter name objects in the stream dictionary.
ASCII85Filter
ASCII85Filter implements the ASCII85Decode filter (§7.4.3). It encodes binary data
as printable ASCII85 characters for inclusion in text-based PDF files.
ASCII85Filter filter = new ASCII85Filter();
byte[] encoded = filter.encode(rawBytes, null);
byte[] decoded = filter.decode(encoded, null);
String name = filter.getName().toString(); // "ASCII85Decode"ASCIIHexFilter
ASCIIHexFilter implements the ASCIIHexDecode filter (§7.4.2). It encodes bytes as
pairs of hexadecimal characters:
ASCIIHexFilter filter = new ASCIIHexFilter();
byte[] encoded = filter.encode(rawBytes, null);
byte[] decoded = filter.decode(encoded, null);COSFilter
COSFilter is the abstract base class for all PDF stream filter implementations.
Both ASCII85Filter and ASCIIHexFilter extend COSFilter and implement the
encode() and decode() methods alongside getName() which returns the filter’s
COSName.