pdf

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package pdf is an Extractor for PDF files, backed by the pure-Go github.com/ledongthuc/pdf (no cgo, so the static-binary and cross-compile goals hold). Extraction is best-effort text in reading order — layout, columns, and tables are not preserved, and scanned/image-only PDFs yield nothing. The library can panic on malformed input, so Extract recovers and reports an error rather than crashing the process.

Index

Constants

View Source
const ContentType = "application/pdf"

ContentType is the media type for PDF files.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extractor

type Extractor struct{}

Extractor extracts plain text from PDF content. Its zero value is ready.

func New

func New() Extractor

New returns a PDF Extractor.

func (Extractor) Extract

func (e Extractor) Extract(contentType string, raw []byte) (text string, err error)

Extract returns the PDF's text in reading order. A malformed PDF yields an error (including one recovered from a panic in the underlying library), never a crash.

func (Extractor) Supports

func (Extractor) Supports(contentType string) bool

Supports reports whether the content type is a PDF.

Jump to

Keyboard shortcuts

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