character_count

Returns character count in PDF-document.

pub fn character_count(&self) -> Result<i32, PdfError>

Arguments

Returns

  • Ok(i32) - if the operation succeeds
  • Err(PdfError) - if the operation fails

Example

use asposepdf::Document;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Open a PDF-document from file
    let pdf = Document::open("sample.pdf")?;

    // Return character count in PDF-document
    let count = pdf.character_count()?;

    // Print the character count
    println!("Character count: {}", count);

    Ok(())
}