Skip to main content

OfdReader

Struct OfdReader 

Source
pub struct OfdReader { /* private fields */ }
Expand description

An OFD document reader.

Implementations§

Source§

impl OfdReader

Source

pub fn open(path: impl AsRef<Path>) -> OfdResult<Self>

Open and parse an OFD file from a path.

§Errors

Returns an error if the file cannot be read or contains invalid OFD data.

Source

pub fn open_with_options( path: impl AsRef<Path>, options: ReadOptions, ) -> OfdResult<Self>

使用指定选项打开 OFD 文件。

§Errors

文件、ZIP 包或 XML 无效时返回错误。

Source

pub fn from_bytes(data: &[u8]) -> OfdResult<Self>

Parse an OFD file from in-memory bytes.

§Errors

Returns an error if the data is invalid.

Source

pub fn from_seek<R: Read + Seek>( source: R, options: ReadOptions, ) -> OfdResult<Self>

从实现 Read + Seek 的输入读取文档。

§Errors

ZIP 包或 XML 无效时返回错误。

Source

pub fn visit_path( path: impl AsRef<Path>, options: ReadOptions, visitor: impl FnMut(usize, OfdPage) -> OfdResult<()>, ) -> OfdResult<usize>

逐页访问文件,不在内存中保留已经处理过的页面。

回调页码从 1 开始。回调返回错误时立即停止解析。

§Errors

文件、ZIP、XML 或页面回调失败时返回错误。

Source

pub fn page_count(&self) -> usize

Number of pages in the document.

Source

pub fn pages(&self) -> &[OfdPage]

All parsed pages.

Source

pub fn extract_text(&self) -> Vec<String>

Extract text from all pages, one String per page.

Source

pub fn extract_all_text(&self) -> String

Extract all text joined into a single string with page separators.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.