Adaptive Pixel Sampling for Seamless Text Replacement
Most PDF documents do not use pure `#FFFFFF` white backgrounds; they often have subtle off-white tones (`#F8F9FA`, `#FAFAFA`) or faint paper textures. Overlaying a pure white rectangle creates a visible, artificial patch. This editor uses **localized pixel color sniffing**:
Localized Color Sampling
Before redacting original text, the engine inspects the adjacent background pixels from the rendered 2D canvas context to calculate the exact average RGB value, making the replacement patch blend into the surrounding page.
Optical Baseline Alignment
Replacement text coordinates are calculated relative to font descent and ascent metrics, ensuring new words align naturally with existing text on the same line.