chk_defaced 0.4.0

Detect tampered documents before they reach an LLM: font defacement (the extracted text differs from the glyphs actually drawn) and invisible or cloaked text, in PDF, DOCX and HTML. Deterministic, no LLM, no network.
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(())
}