pub struct PlainTextResult {
pub text: String,
pub line_count: usize,
pub char_count: usize,
}Expand description
Result of plain text extraction
Contains the extracted text and metadata about the extraction.
Unlike ExtractedText, this does not include position information
for individual text fragments.
§Examples
ⓘ
use oxidize_pdf::Document;
use oxidize_pdf::text::plaintext::PlainTextExtractor;
let doc = Document::open("document.pdf")?;
let page = doc.get_page(1)?;
let extractor = PlainTextExtractor::new();
let result = extractor.extract(&doc, page)?;
println!("Extracted {} characters in {} lines",
result.char_count,
result.line_count
);Fields§
§text: StringExtracted text content
The complete text content from the page, with spaces and newlines inserted according to the configured thresholds and line break mode.
line_count: usizeNumber of lines in the extracted text
Lines are counted by splitting on \n characters. A document with
no newlines will have a line_count of 1.
char_count: usizeNumber of characters in the extracted text
Total character count including spaces and newlines.
Implementations§
Source§impl PlainTextResult
impl PlainTextResult
Sourcepub fn new(text: String) -> Self
pub fn new(text: String) -> Self
Create a new result from text
Automatically calculates line_count and char_count from the text.
§Examples
use oxidize_pdf::text::plaintext::PlainTextResult;
let result = PlainTextResult::new("Hello\nWorld".to_string());
assert_eq!(result.line_count, 2);
assert_eq!(result.char_count, 11);Trait Implementations§
Source§impl Clone for PlainTextResult
impl Clone for PlainTextResult
Source§fn clone(&self) -> PlainTextResult
fn clone(&self) -> PlainTextResult
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PlainTextResult
impl Debug for PlainTextResult
impl Eq for PlainTextResult
Source§impl PartialEq for PlainTextResult
impl PartialEq for PlainTextResult
impl StructuralPartialEq for PlainTextResult
Auto Trait Implementations§
impl Freeze for PlainTextResult
impl RefUnwindSafe for PlainTextResult
impl Send for PlainTextResult
impl Sync for PlainTextResult
impl Unpin for PlainTextResult
impl UnsafeUnpin for PlainTextResult
impl UnwindSafe for PlainTextResult
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