pdfcpu

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pdfcpu adapts github.com/pdfcpu/pdfcpu (Apache-2.0, pure Go) to the objects.Store interface.

This is a borrowed layer, isolated so it can be replaced by a native parser without touching callers. Everything pdfcpu-specific stays inside this file: its types never appear in a signature that objects.Store exposes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(rs io.ReadSeeker) (objects.Store, error)

New reads a PDF from rs. The reader must stay valid for the lifetime of the Store: pdfcpu resolves object streams lazily and seeks back to the file.

func NewFromBytes

func NewFromBytes(b []byte) (objects.Store, error)

NewFromBytes reads a PDF held in memory.

func Open

func Open(path string) (objects.Store, error)

Open reads the PDF at path.

The path comes from the caller by design — this is a library and CLI whose purpose is to open the file a user names. Callers that need to confine reads to a directory should resolve and check the path themselves, then use New with an *os.File, or use os.Root and pass the resulting file.

Types

type Decoder

type Decoder interface {
	Decode(*objects.Stream) error
}

Decoder is implemented by stores that can decode stream filter chains. Callers type-assert for it so the capability is discoverable without widening objects.Store, which a native parser will satisfy directly.

type ReadStats

type ReadStats struct {
	FileSize           int64
	Linearized         bool
	Hybrid             bool
	UsingObjectStreams bool
	UsingXRefStreams   bool
	BinaryTotalSize    int64
	BinaryImageSize    int64
	BinaryFontSize     int64
}

ReadStats reports what the parser observed about file structure. It is adapter-specific diagnostic detail, surfaced for `probe` rather than promoted into objects.Store, because a different parser would report different things.

type Statser

type Statser interface {
	Stats() ReadStats
}

Statser is implemented by stores that report file-structure statistics.

Jump to

Keyboard shortcuts

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