Documentation
¶
Overview ¶
Package filter decodes PDF stream filters (ISO 32000-2 §7.4).
The five filters here are the ones needed to read text: Flate, LZW, ASCIIHex, ASCII85, and RunLength. The image filters — DCTDecode, CCITTFaxDecode, JBIG2Decode, JPXDecode — are deliberately absent. Image data is passed through still encoded so it can be written out in its original form without a lossy re-encode, which is what an image extractor wants.
That passthrough is the contract the image package is built on: it reads the codec off the chain this package stopped at, so a Flate-then-DCT stream reaches it as a decompressed JPEG that needs no further decoding to become a .jpg.
Decoding is owned rather than borrowed because it is small, entirely covered by the standard library, and sits on the hot path for every page.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("filter: unsupported")
ErrUnsupported is returned for a filter this package does not decode, including the image filters it deliberately leaves encoded.
Functions ¶
func DecodeChain ¶
DecodeChain applies a stream's whole filter chain in order.
A chain stops at the first image filter, returning the data as it stands with the remaining filters reported. That is not a failure: it is how a Flate-then-DCT stream yields a decompressed JPEG.
Types ¶
This section is empty.