extract_text
Devuelve el contenido del PDF-documento como texto plano.
pub fn extract_text(&self) -> Result<String, PdfError>
Arguments
Returns
- Ok(String) - if the operation succeeds
- Err(PdfError) - if the operation fails
Example
use asposepdf::Document;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Abrir un documento PDF con nombre de archivo
let pdf = Document::open("sample.pdf")?;
// Devolver el contenido del PDF-documento como texto plano
let txt = pdf.extract_text()?;
// Imprimir texto extraído
println!("Extracted text:\n{}", txt);
Ok(())
}