chk_defaced 0.2.0

Detect 'defaced' documents: verify the coherence of the fonts used to render text (PDF, DOCX, HTML+CSS) and build a JSON index of the system fonts' cmaps.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! Render-input check: `cargo run --example docx_html -- in.docx out.html`
//! Emits the self-contained HTML (embedded fonts as base64 `@font-face`) for visual/render-OCR
//! validation in any browser/webview.

use std::path::PathBuf;

fn main() -> anyhow::Result<()> {
    let mut args = std::env::args().skip(1);
    let input = PathBuf::from(args.next().expect("usage: docx_html <in.docx> <out.html>"));
    let output = PathBuf::from(args.next().expect("usage: docx_html <in.docx> <out.html>"));
    let html = chk_defaced::docx_html::docx_to_html(&input)?;
    std::fs::write(&output, &html)?;
    eprintln!("wrote {} bytes → {}", html.len(), output.display());
    Ok(())
}