Edit text in a scanned PDF
Short answer: Words on a scan are usually part of an image. EnjoyPDF recognizes the words you want to change and writes the replacement in the same position. Fonts and backgrounds may not match exactly. Check the preview and review the saved file.
What problem it solves
In PDFs made from scans, photos and screenshots, the text on the page is really pixels in an image. There are two common ways to change it: put a white or background-colored box over the old text and write new text on top, or recognize the whole page as text and lay it out again. The first leaves color patches and visible edges. The second changes the font, line spacing and layout, so the page no longer looks like the original file.
EnjoyPDF targets the selected words and aims to retain the page layout. Saving the image again, repairing the background and choosing a replacement font can affect the result. Keep the original file.
This page describes the Windows software. Check the Windows download page for availability. The browser text extraction tool cannot edit words in scanned images.
How to change the text
- Open a PDF you are entitled to edit and enter the words to find.
- Check the matches and enter the replacement text.
- Use “Preview replacement” to check for text overlapping nearby content.
- Save a new file and compare it with the original. Automatic checks help find problems but do not replace your review.
How text in images is handled
- Find the text: images that cover 10% or more of the page are recognized offline (PP-OCRv6 for Chinese, the PP-OCRv5 Thai model for Thai) to get the position of each character.
- Erase only the strokes: the exact stroke area is computed from the color difference between the ink and the surrounding background. It includes blurred edges and JPEG ringing, but not the whole text box.
- Fill the background: a clean patch of background is taken from nearby and blended in with Poisson blending, so paper texture, grain, halftone dots, gradients and photo backgrounds are real. If no suitable patch is found, an inpainting algorithm is used and the surrounding paper grain is added back. After each erase, color difference, grain and edges are checked automatically and the better result is kept. Table lines that cross the text are kept.
- Draw the new text: the color is fitted to the original ink (including gradients). Blur and uneven ink are measured on the original and applied, and the new text follows the slant of the original line.
What if the text can already be selected and copied?
Selectable, copyable PDF text is often called a “text layer”. EnjoyPDF keeps the original font, size, color and transparency:
- The font embedded in the PDF is reused first. If the subset is missing characters, only a complete local font with the same name is tried.
- If no usable original font is found, a clear error is shown. The text is not quietly switched to a generic font.
- Replacements of the same length keep each character’s position. When the length differs, the text is written from the original position at the original size.
Alignment and overflow
When the old and new text differ in length, you can choose left, right (useful for right-aligned number columns such as amounts) or center alignment. When text in an image is too long, you can allow it to overflow, compress it horizontally (down to 60%), or keep it inside the original area (reducing the font size if needed). Overflowing text does not run into the next word on the same line.
Automatic fallback
The following images cannot be changed in the original image. For these, the replacement is placed over the page instead, and the result says so: CMYK or palette images, 1-bit fax images, JPEG 2000, images shared by several pages or placed twice on the same page, and images placed at an angle.
Current limits
- Horizontal single-line text is supported, following a slant of up to about 3°. Text across lines, photos with strong perspective or curvature, and text converted to outlines are not handled. Vertical text: Japanese was tested on real scans; Simplified Chinese vertical text is supported in code but untested; vertical Traditional Chinese pages with zhuyin are refused (see the supported features and languages).
- Recognition is weak for handwriting, decorative fonts, scans below about 150 DPI, and very small text.
- By default, a replacement longer than the original is written at the original size and may cover content to its right. Check the preview.
FAQ
Can the corrected text still be searched and copied?
Yes. When the new text is drawn into the image, an invisible text layer is added at the same position, so the replacement can be searched and copied.
Is the original image recompressed?
JPEG images are compressed again when saved. This can cause small changes even outside the edited area, and the file size can change. Keep the original and check the saved result.
Is the new text in the same font as the original?
The original font of text in an image cannot be identified, so the selected font is used as an approximation. "Auto" chooses a local font based on the text, such as SimSun, PMingLiU, a Mincho font, Tahoma or Arial. Weight and darkness are matched to the original ink. For text-layer PDFs, the original embedded font is reused first.
When are results weaker?
Repair is less clean when text sits on a stamp or watermark, when an object outline runs under the text, or when no clean background can be found nearby. Check with "Preview replacement" before saving.