pub struct Doc { /* private fields */ }Expand description
A PDF opened by docling-parse; renders its pages on request.
Implementations§
Source§impl Doc
impl Doc
Sourcepub fn open_if_enabled(bytes: &[u8], password: Option<&str>) -> Option<Doc>
pub fn open_if_enabled(bytes: &[u8], password: Option<&str>) -> Option<Doc>
Open bytes with the plugin when it is active; None when the pipeline
should render with pdfium. An open failure warns and returns None too,
so a document docling-parse rejects still converts.
Sourcepub fn page_count(&self) -> usize
pub fn page_count(&self) -> usize
Number of pages docling-parse sees.
Sourcepub fn render(&self, page: usize, scale: f64) -> Result<RgbImage, String>
pub fn render(&self, page: usize, scale: f64) -> Result<RgbImage, String>
Render the 0-based page at scale pixels per point: docling-parse’s
get_image(scale) canvas — ceil(w·scale) × ceil(h·scale), display
orientation — with its opaque white background, so the alpha plane is
dropped and the RGB triples are returned as they are.
Sourcepub fn release_page(&self, page: usize)
pub fn release_page(&self, page: usize)
Drop the decoded state of page once every scale of it was rendered.
Trait Implementations§
Auto Trait Implementations§
impl !Sync for Doc
impl Freeze for Doc
impl RefUnwindSafe for Doc
impl Unpin for Doc
impl UnsafeUnpin for Doc
impl UnwindSafe for Doc
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
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> ⓘ
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