pdf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 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 pdf inspects uploaded PDFs: limits, encryption, existing signatures, and whether Inkless can seal them.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTooLarge means the file exceeds Limits.MaxBytes.
	ErrTooLarge = errors.New("pdf exceeds the size limit")
	// ErrMalformed means the input is not a parseable PDF.
	ErrMalformed = errors.New("pdf is malformed")
	// ErrEncrypted means the PDF has an Encrypt dictionary.
	ErrEncrypted = errors.New("pdf is encrypted")
	// ErrTooManyPages means the PDF has more than Limits.MaxPages pages.
	ErrTooManyPages = errors.New("pdf exceeds the page limit")
	// ErrSigned means the PDF already carries a signature or certification.
	ErrSigned = errors.New("pdf already contains signatures")
	// ErrUnsealable means the PDF structure cannot be sealed by this service.
	ErrUnsealable = errors.New("pdf structure is not supported for sealing")
)

Errors returned by Inspect, one per rejection reason.

View Source
var DefaultLimits = Limits{MaxBytes: 20 << 20, MaxPages: 200}

DefaultLimits allows 20 MiB and 200 pages.

Functions

func Inspect

func Inspect(b []byte, l Limits) (pages int, err error)

Inspect validates b against l and returns its page count. It returns one of the Err values when b is rejected and never panics on malformed input.

Types

type Limits

type Limits struct {
	// MaxBytes is the largest accepted file size in bytes.
	MaxBytes int64
	// MaxPages is the largest accepted page count.
	MaxPages int
}

Limits bounds the PDFs Inspect accepts.

Jump to

Keyboard shortcuts

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