Documentation
¶
Index ¶
Constants ¶
View Source
const MaxPDFSize = 20 * 1024 * 1024
MaxPDFSize is the maximum raw PDF size (20 MB). After base64 encoding (~33% larger) this leaves room for conversation context within a 32 MB API limit.
Variables ¶
This section is empty.
Functions ¶
func GetPageCount ¶
GetPageCount returns the number of pages in a PDF using the `pdfinfo` command-line tool (from poppler-utils). Returns an error if pdfinfo is not available or the page count cannot be determined.
Types ¶
type ExtractResult ¶
ExtractResult holds the output directory and page count from page extraction.
func ExtractPages ¶
func ExtractPages(path string, firstPage, lastPage int) (ExtractResult, error)
ExtractPages converts PDF pages to JPEG images using `pdftoppm` (from poppler-utils). firstPage and lastPage are 1-indexed and inclusive. Pass 0 for either to use pdftoppm defaults (all pages).
Click to show internal directories.
Click to hide internal directories.