pdf_oxide_cli 0.3.51

CLI for pdf-oxide — the fastest PDF toolkit. 22 commands: text extraction, PDF to markdown, search, merge, split, images, compress, encrypt, watermark, forms, and more.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! `pdf-oxide classify <file>` — cheap per-page text-vs-OCR
//! classification (no OCR, no rasterisation), printed as JSON
//! `DocumentClassification` (#517). The frozen cross-binding envelope.

use std::path::Path;

pub fn run(file: &Path, password: Option<&str>, _json: bool) -> pdf_oxide::Result<()> {
    let doc = super::open_doc(file, password)?;
    let cls = doc.classify_document()?;
    let out = serde_json::to_string_pretty(&cls)
        .map_err(|e| pdf_oxide::Error::InvalidOperation(e.to_string()))?;
    println!("{out}");
    Ok(())
}