Expand description
Text replacement in PDF content streams (legacy convenience API).
Since Phase 1C these functions are thin wrappers over the
crate::text_edit engine (see docs/TEXT_REPLACE_ENGINE_DESIGN.md §9).
They keep the historical count-only contract: per-occurrence failures are
not errors, they simply do not count. Callers that need per-edit
diagnostics, single-occurrence selection, signature protection or stream
preservation guarantees should use crate::text_edit directly.
Behaviour changes relative to the pre-1C implementation (deliberate, each covered by a flipped characterization test):
- multiple
/Contentsstreams are preserved instead of collapsed; - text covered by
/ActualTextis left untouched instead of desynced; - cross-run matches whose replacement needs a fallback font now succeed;
- TJ kerning outside the edited region is preserved;
- encrypted documents whose permissions forbid modification are refused.
Functions§
- replace_
text - Replace all occurrences of
searchwithreplacementin a page’s content. - replace_
text_ all_ pages - Replace text across all pages in a document.