mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-03 09:11:59 +08:00
23 lines
523 B
Go
23 lines
523 B
Go
//go:build cgo
|
|
|
|
package pdf
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
pdf "ragflow/internal/deepdoc/parser/pdf/type"
|
|
)
|
|
|
|
// Parse runs the full PDF extraction pipeline from raw bytes.
|
|
// Creates and manages the PDF engine lifecycle internally.
|
|
func (p *Parser) Parse(ctx context.Context, data []byte, docAnalyzer pdf.DocAnalyzer) (*pdf.ParseResult, error) {
|
|
engine, err := NewEngine(data)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("pdfoxide.NewEngine: %w", err)
|
|
}
|
|
defer engine.Close()
|
|
|
|
return p.ParseRaw(ctx, engine, docAnalyzer)
|
|
}
|