Expand description
PDF content extractor.
Uses pdf-extract to extract text content and lopdf for embedded images.
Re-exportsยง
use async_trait::async_trait;๐use flate2::read::ZlibDecoder;๐use lopdf::Document;๐use ragfs_core::ContentElement;๐use ragfs_core::ContentExtractor;๐use ragfs_core::ContentMetadataInfo;๐use ragfs_core::ExtractError;๐use ragfs_core::ExtractedContent;๐use ragfs_core::ExtractedImage;๐use std::io::Read;๐use std::path::Path;๐use tracing::debug;๐use tracing::warn;๐
Structsยง
- PdfExtractor
- Extractor for PDF files.
Constantsยง
- MAX_
IMAGES ๐ - Configuration for image extraction limits.
- MAX_
TOTAL_ ๐BYTES - MIN_
DIMENSION ๐
Functionsยง
- build_
elements ๐ - Build
ContentElementsfrom extracted text. - cmyk_
to_ ๐rgb - Convert CMYK bytes to RGB.
- decode_
flate_ ๐image - Decode
FlateDecodecompressed image to PNG. - decode_
pdf_ ๐image - Decode a PDF image into
ExtractedImageformat. - estimate_
page_ ๐count - Estimate page count from text.
- extract_
pdf_ ๐images - Extract images from PDF document using lopdf.
- extract_
pdf_ ๐text - Extract text from PDF bytes using pdf-extract.
- looks_
like_ ๐heading - Heuristic to detect if text looks like a heading.