Documentation ¶
Overview ¶
Implements a PDF object parser, mapping a list of tokens (see the tokenizer package) into tree-like structure. Higher-level reader is neeed to decrypt a full PDF file.
Index ¶
- func ParseContent(content []byte, res model.ResourcesColorSpace) ([]cs.Operation, error)
- func ParseContentResources(content []byte, res model.ResourcesColorSpace) (model.ResourcesDict, error)
- func ParseDirectFilters(filters, decodeParams Object) (model.Filters, error)
- func ParseFilters(filters, decodeParams Object, resolver func(Object) (Object, error)) (model.Filters, error)
- type Array
- type Bool
- type Command
- type Dict
- type Fl
- type Float
- type HexLiteral
- type IndirectRef
- type Integer
- type Name
- type Object
- type Parser
- type StringLiteral
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseContent ¶
ParseContent parse a decrypted Content Stream. A resource dictionary is needed to handle inline image data, which can refer to a color space.
func ParseContentResources ¶
func ParseContentResources(content []byte, res model.ResourcesColorSpace) (model.ResourcesDict, error)
ParseContentResources return the resources needed by content. Note that only the names in the returned dicts are valid, all the values will be nil.
func ParseDirectFilters ¶
ParseDirectFiltersis the same as ParseFilters, but for direct objects. It is the case in image inline parameters and xRefStream dicts.
func ParseFilters ¶
func ParseFilters(filters, decodeParams Object, resolver func(Object) (Object, error)) (model.Filters, error)
ParseFilters process the given filters and their (optionnal) parameters. `resolver` is called to resolve the potential indirect objects An empty list may be returned if the filters are nil.
Types ¶
type Command ¶
type Command = model.ObjCommand
type HexLiteral ¶
type HexLiteral = model.ObjHexLiteral
type IndirectRef ¶
type IndirectRef = model.ObjIndirectRef
type Object ¶
func ParseObject ¶
ParseObject tokenizes and parses the input, expecting a valid PDF object.
type Parser ¶
type Parser struct { // If true, disallow Indirect Reference, // but allow Commands ContentStreamMode bool // contains filtered or unexported fields }
Standalone implementation of a PDF parser. The parser only handles chunks of PDF files (corresponding for example to object definitions), but cannot handle a full file with streams. An higher-level reader is needed to decode Streams and Inline Data, which require knowledge on the filters used.
func NewParserFromTokenizer ¶
NewParserFromTokenizer use a tokenizer as input.
func (*Parser) ParseContentElement ¶
ParseContentElement parse one operation and avances. `ContentStreamMode` must have been set to true, and EOF should be checked before calling with method. See `ParseContent` for a convenient way of parsing a whole content stream.
func (*Parser) ParseObject ¶
ParseObject read one of the (potentially) many objects in the input data (See NewParser).
type StringLiteral ¶
type StringLiteral = model.ObjStringLiteral