Skip to main content

ExtractorFilter

Trait ExtractorFilter 

Source
pub trait ExtractorFilter: Debug {
    // Required method
    fn filter_text(&self, text: &str, page_num: usize) -> Option<String>;
}
Expand description

文本抽取过滤器 trait。

对应 Java: org.ofdrw.reader.extractor.ExtractorFilter@FunctionalInterface

实现此 trait 可以自定义文本抽取的过滤逻辑, 例如按区域过滤、按字体过滤等。

Required Methods§

Source

fn filter_text(&self, text: &str, page_num: usize) -> Option<String>

判断指定文本是否应被抽取。

§参数
  • text: 文本内容。
  • page_num: 页码(从 1 开始)。
§返回

返回过滤后的文本(可以与原文本不同),返回 None 表示过滤掉。

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§