parser

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStreamAware

func NewStreamAware(s scanner.Scanner) *streamAware

func ParseHintStream

func ParseHintStream(data []byte, dict *raw.DictObj, npages int) (*raw.HintTable, error)

ParseHintStream parses the hint stream data. The dict is the dictionary of the hint stream object (containing S, T, O, etc.). npages is the number of pages in the document (from Linearization dict).

Types

type Cache

type Cache interface {
	Get(ref raw.ObjectRef) (raw.Object, bool)
	Put(ref raw.ObjectRef, obj raw.Object)
}

type Config

type Config struct {
	Recovery    recovery.Strategy
	XRef        xref.ResolverConfig
	MaxIndirect int
	Security    security.Handler
	Limits      security.Limits
	Cache       Cache
	Password    string
}

Config controls high-level PDF parsing (xref resolution + object loading).

type DocumentParser

type DocumentParser struct {
	// contains filtered or unexported fields
}

DocumentParser builds a raw.Document using xref tables/streams and the object loader.

func NewDocumentParser

func NewDocumentParser(cfg Config) *DocumentParser

func (*DocumentParser) Parse

func (p *DocumentParser) Parse(ctx context.Context, r io.ReaderAt) (*raw.Document, error)

func (*DocumentParser) SetPassword

func (p *DocumentParser) SetPassword(pwd string)

SetPassword updates the password for decryption when parsing encrypted PDFs.

type ObjectLoader

type ObjectLoader interface {
	Load(ctx context.Context, ref raw.ObjectRef) (raw.Object, error)
	LoadIndirect(ctx context.Context, ref raw.ObjectRef, depth int) (raw.Object, error)
}

type ObjectLoaderBuilder

type ObjectLoaderBuilder struct {
	// contains filtered or unexported fields
}

func (*ObjectLoaderBuilder) Build

func (b *ObjectLoaderBuilder) Build() (ObjectLoader, error)

func (*ObjectLoaderBuilder) WithCache

func (*ObjectLoaderBuilder) WithLimits

func (*ObjectLoaderBuilder) WithReader

func (*ObjectLoaderBuilder) WithSecurity

func (*ObjectLoaderBuilder) WithXRef

func (b *ObjectLoaderBuilder) WithXRef(table xref.Table) *ObjectLoaderBuilder

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL