inspect

package
v0.0.0-...-f985856 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package inspect provides lightweight PDF inspection helpers.

Index

Constants

This section is empty.

Variables

View Source
var ErrTextLimitExceeded = errors.New("pdf text extraction limit exceeded")

ErrTextLimitExceeded reports that PDF text extraction exceeded a bounded operand, nesting, token, or output limit.

Functions

func DecodedStreams

func DecodedStreams(data []byte) ([][]byte, error)

DecodedStreams returns raw or Flate-decoded PDF streams in file order.

func DecodedStreamsContext

func DecodedStreamsContext(ctx context.Context, data []byte) ([][]byte, error)

DecodedStreamsContext returns raw or Flate-decoded PDF streams in file order and honors ctx while scanning and decoding streams.

func FirstPageSizePoints

func FirstPageSizePoints(data []byte) (float64, float64, error)

FirstPageSizePoints returns the first MediaBox dimensions in PDF points.

func PageCount

func PageCount(data []byte) (int, error)

PageCount returns the number of pages PDFRune can parse from data.

func PageCountContext

func PageCountContext(ctx context.Context, data []byte) (int, error)

PageCountContext returns the number of pages PDFRune can parse from data and honors ctx while importing the page tree.

func PageText

func PageText(data []byte, pageNum int) (string, error)

PageText extracts text from one importable PDF page.

func PageTextContext

func PageTextContext(ctx context.Context, data []byte, pageNum int) (string, error)

PageTextContext extracts text from one importable PDF page while honoring ctx.

func Text

func Text(data []byte) (string, error)

Text extracts literal text operators from PDF content streams.

func TextContext

func TextContext(ctx context.Context, data []byte) (string, error)

TextContext extracts literal text operators from page content streams and honors ctx during page parsing and text tokenization. Non-page streams such as metadata, fonts, images, and attachments are not treated as document text.

func ValidateStructure

func ValidateStructure(data []byte) error

ValidateStructure checks that data can be parsed as an unencrypted classic PDF with at least one importable page.

func ValidateStructureContext

func ValidateStructureContext(ctx context.Context, data []byte) error

ValidateStructureContext checks that data can be parsed as an unencrypted classic PDF with at least one importable page and honors ctx during parsing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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