Documentation
¶
Overview ¶
Package filter implements the PDF stream decode filters of ISO 32000-1 §7.4 that text extraction needs: FlateDecode, LZWDecode, ASCIIHexDecode, ASCII85Decode and RunLengthDecode, with the PNG and TIFF predictors. The image codecs (DCTDecode, JPXDecode, CCITTFaxDecode, JBIG2Decode) are not stream filters here: Apply rejects them, and ImageCodec identifies them so a caller can stop a filter chain at the codec and hand the still-encoded image data to a decoder.
The package knows nothing about the PDF object model: callers extract /DecodeParms fields into Params.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply wraps r with the named decode filter. The returned reader fails on malformed data rather than panicking; callers bound total output.
func ImageCodec ¶ added in v0.5.0
ImageCodec reports whether name (full or abbreviated) is one of the image codecs, returning its full name: DCTDecode, JPXDecode, CCITTFaxDecode or JBIG2Decode.
Types ¶
type Params ¶
type Params struct {
Predictor int
Colors int
BitsPerComponent int
Columns int
NoEarlyChange bool // LZW /EarlyChange 0 (the non-default variant)
}
Params carries the /DecodeParms fields a filter consumes. The zero value means the spec defaults (Predictor 1, Colors 1, BitsPerComponent 8, Columns 1, EarlyChange 1).