Documentation
¶
Overview ¶
Package document reads the files a model is given: PDF, Word and Excel files and text as text, images as images, and the scanned pages of a PDF as images.
Index ¶
Constants ¶
View Source
const ( // MaxFileBytes bounds one file. MaxFileBytes = 50 << 20 // MaxImages bounds the images a model is given at once, image files and // scanned pages together. MaxImages = 50 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// Name is the file's base name.
Name string
// Text is the file's text; a PDF's text is in Pages instead.
Text string
// Image is an image file, scaled to fit a model.
Image *Image
// Pages are a PDF's pages.
Pages []Page
}
File is a file as a model takes it.
func Read ¶
Read reads one file. PDF text is read with PDFium, the PDF engine of Chrome, so the embedded fonts Japanese documents use are read; a page with no text is rendered to an image. Word and Excel files are read as text, a paragraph or row a line; text files in UTF-8 or Shift_JIS; images are scaled down when larger than a model takes.
Click to show internal directories.
Click to hide internal directories.