pdf-textlayer
Add an invisible, searchable text layer to a PDF from OCR boxes. Each box is drawn at its location in text render mode 3, so the page looks the same and becomes selectable and searchable. Pages without boxes are left as they are, and a box that lands on a word the page already contains is skipped.
This crate is the core of the pdf-textlayer Python and Node.js packages, and ships the pdf-textlayer command.
use ;
// OCR JSON from a supported tool
let stats = make_searchable_pdf?;
// Boxes from anywhere else
let pages = vec!;
let stats = write_text_layer?;
add_text_layer does the same for a PDF held in memory. The default cli feature adds the binary and pdf_textlayer::cli; turn it off with default-features = false to drop clap.
License: MIT.