pub struct SpdfParser { /* private fields */ }Expand description
High-level document parser.
Implementations§
Source§impl SpdfParser
impl SpdfParser
Sourcepub fn new(config: ParseConfig) -> Self
pub fn new(config: ParseConfig) -> Self
Build a parser with explicit config. Use Self::builder for the
defaults-plus-overrides pattern that mirrors new LiteParse({ ... }).
Sourcepub fn with_ocr_engine(self, engine: Arc<dyn OcrEngine>) -> Self
pub fn with_ocr_engine(self, engine: Arc<dyn OcrEngine>) -> Self
Inject a custom OCR engine (e.g. for tests or a Tesseract build).
Sourcepub fn builder() -> ParseConfigBuilder
pub fn builder() -> ParseConfigBuilder
Start from the shared defaults (equivalent to DEFAULT_CONFIG).
pub fn config(&self) -> &ParseConfig
Sourcepub fn parse(&self, input: impl Into<ParseInput>) -> SpdfResult<ParseResult>
pub fn parse(&self, input: impl Into<ParseInput>) -> SpdfResult<ParseResult>
Parse a document to the caller-selected output.
Sourcepub fn stream<I: Into<ParseInput>>(
&self,
input: I,
) -> SpdfResult<Box<dyn Iterator<Item = SpdfResult<ParsedPage>> + '_>>
pub fn stream<I: Into<ParseInput>>( &self, input: I, ) -> SpdfResult<Box<dyn Iterator<Item = SpdfResult<ParsedPage>> + '_>>
Stream one parsed page at a time without materialising the full
document in memory. Yields (page_index, ParsedPage) pairs in the
same order as parse. Errors abort the iterator.
Sourcepub fn screenshot(
&self,
input: impl Into<ParseInput>,
page_numbers: Option<Vec<u32>>,
) -> SpdfResult<Vec<ScreenshotResult>>
pub fn screenshot( &self, input: impl Into<ParseInput>, page_numbers: Option<Vec<u32>>, ) -> SpdfResult<Vec<ScreenshotResult>>
Render specific (or all) pages to PNG buffers.
Sourcepub fn format(&self, result: &ParseResult) -> String
pub fn format(&self, result: &ParseResult) -> String
Convenience formatter respecting the configured output format.
Auto Trait Implementations§
impl Freeze for SpdfParser
impl !RefUnwindSafe for SpdfParser
impl Send for SpdfParser
impl Sync for SpdfParser
impl Unpin for SpdfParser
impl UnsafeUnpin for SpdfParser
impl !UnwindSafe for SpdfParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more