You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found an issue with certain PDFs that already have text where the text is replaced with other characters and renders the PDFs unreadable. This happens with the --redo-ocr and --skip-text flags. Attached are (a) a sample PDF (b) the results of it being OCRed, and (c) a zip file containing everything needed to reproduce the issue.
Steps to reproduce
1. Download the tarball to a linux machine with Docker installed.
2. Run the following command chain: tar -xzf bad-pdf-example.tar.gz && cd bad-pdf-example && docker run --rm -v .:/root/test-files -it $(docker build -q -t ocrmypdf-test .) && docker rmi ocrmypdf-test:latest
3. Open test-redo-ocr-result.pdf and test-skip-text-result.pdf
The problem with this file is that does not embed the fonts it uses. In this case, Arial Bold and Arial Bold Italic. It was previous processed by Nitro Pro 13.
When Ghostscript (which OCRmyPDF uses), it replaces the missing with a substitute, using "DroidSansFallback". The kerning of the substitute is different, so the PDF viewer sees spaces between letters. At least for me. I don't know how an Asian font was substituted in your version.
ocrmypdf --output-type pdf avoids Ghostscript, and produces a usable result.
Try doing gs -sDEVICE=pdfwrite -o output.pdf test.pdf
and see if you can reproduce the Japanese-Korean version, then reporting to Ghostscript. I won't report because there's potentially personal information in the test file that is not mine.
ocrmypdf --force-ocr would also fix this file completely, with or without Ghostscript.
I am considering adding a warning about Ghostscript font substitution, especially if someone else encounters this. Ghostscript has had several issues with mangling text recently.
Describe the bug
Found an issue with certain PDFs that already have text where the text is replaced with other characters and renders the PDFs unreadable. This happens with the
--redo-ocr
and--skip-text
flags. Attached are (a) a sample PDF (b) the results of it being OCRed, and (c) a zip file containing everything needed to reproduce the issue.Steps to reproduce
Files
test.pdf
test-redo-ocr-result.pdf
test-skip-text-result.pdf
bad-pdf-example.tar.gz
How did you download and install the software?
Linux package manager (apt, dnf, etc.), Docker container
OCRmyPDF version
16.3.1
Relevant log output
The text was updated successfully, but these errors were encountered: