Extract the text of a document
Open a document and print its text, first as one string in reading order and then page by page.
use pdfluent::PdfDocument;
let doc = PdfDocument::open("invoice.pdf")?;
// The full text, in reading order.
let text = doc.extract_text()?;
println!("{text}");
// Or per page.
for n in 0..doc.page_count() {
println!("--- page {} ---", n + 1);
println!("{}", doc.page(n)?.text()?);
}// site:open-and-extract in crates/pdfluent/examples/site_snippets.rs