pub struct PageTextParser { /* private fields */ }Expand description
The parser text layer, driven one page at a time: the document is loaded
(and repaired, see [load_document]) once, the font/form caches persist
across pages, and each page’s glyphs are parsed only when asked for.
The eager whole-document walk this replaces ran before the first page
was rendered, so on a long PDF it was a serial prefix the page-worker pool
sat idle through — 6.2 s on the 1913-page .NET reference, in front of a
pipeline that otherwise overlaps parsing with inference — and a --pages
window still paid for every page in the file. Pulling pages on demand
keeps the parse on the producer thread but interleaved with rendering,
and skips unselected pages entirely. Output per page is unchanged: same
glyph walk, same shared caches, same contraction.
Implementations§
Source§impl PageTextParser
impl PageTextParser
Sourcepub fn open(bytes: &[u8]) -> Option<Self>
pub fn open(bytes: &[u8]) -> Option<Self>
Load the document; None when it has no parseable text layer at all
(the caller then keeps pdfium’s cells, as before).
Sourcepub fn cells(&mut self, index: usize) -> PageParserCells
pub fn cells(&mut self, index: usize) -> PageParserCells
Prose, word and code cells of the 0-based page index — empty for an
index the parser’s page tree doesn’t have (pdfium and lopdf can
disagree on a damaged file; the caller falls back to pdfium’s text).
Auto Trait Implementations§
impl !RefUnwindSafe for PageTextParser
impl !UnwindSafe for PageTextParser
impl Freeze for PageTextParser
impl Send for PageTextParser
impl Sync for PageTextParser
impl Unpin for PageTextParser
impl UnsafeUnpin for PageTextParser
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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