Documentation
¶
Overview ¶
Package pdftext reads PDF files: whether data is one, its page count and its text, page by page (spec_011_images). Models that can't read a PDF get its text; read_file shows it. Reading is defensive: the parser's panics become errors and a deadline bounds a pathological file. In the programs (UseHelper), the text is read in a child process that's killed at the deadline, so a page the parser loops on, a crash or a blow-up ends with it.
Index ¶
Constants ¶
const MIME = "application/pdf"
MIME is a PDF's media type.
const Timeout = 20 * time.Second
Timeout bounds reading one file's text.
Variables ¶
var ErrNotPDF = errors.New("not a PDF")
ErrNotPDF is returned for data that isn't a PDF.
Functions ¶
func IsPDF ¶
IsPDF reports whether data starts like a PDF: the "%PDF-" header within its first kilobyte, as readers allow.
func MaybeServe ¶ added in v0.3.0
func MaybeServe()
MaybeServe answers as the helper and exits, when this process was started as one; otherwise it returns at once.
Types ¶
This section is empty.