Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface {
// Warn logs a warning message with optional fields.
// Fields should be key-value pairs (e.g., "category", "image", "error", err).
Warn(msg string, fields ...interface{})
// Debug logs a debug message with optional fields.
Debug(msg string, fields ...interface{})
}
Logger defines the interface for structured logging. Implementations can use any logging library (e.g., zerolog, zap, logrus). If nil, no logging is performed.
type Parser ¶
type Parser struct {
HeadingDetectionEnabled bool // Enable heading detection using heuristics
TableExtractionEnabled bool // Enable table extraction using layout analysis
// contains filtered or unexported fields
}
Parser handles PDF parsing and content extraction using pdfcpu. PDF parsing is more complex than DOCX because PDFs have less semantic structure. Tables, headings, and formatting often require layout analysis rather than direct extraction.
func NewParser ¶
func NewParser() *Parser
NewParser creates a new PDF parser instance with default settings.
func NewParserWithLogger ¶
NewParserWithLogger creates a new PDF parser instance with structured logging.
func (*Parser) Parse ¶
func (p *Parser) Parse(filePath string) (*types.DocumentData, error)
Parse extracts content from a PDF file and returns structured document data. Warnings are collected for non-fatal issues (e.g., failed image extraction, table extraction issues) and returned in DocumentData.Warnings.