Possibly, for August, 2019 there are no programs suitable for all @Doug requirements.
In section “Suggestion” I suggest alternatives. See “Problems” section, to find out what disadvantages of these alternatives do I consider significant.
This answer is relevant for 19 August, 2019. In the future data of this answer may be obsolete. I hope, that all bugs, that described in my answer, will be fixed.
For example, I selected
KiraSuperhero.pdf — bilingual (Russian and English) PDF file without OCR; it contain first 14 pages of real book (I don't added in example full book, because testing operations for it may take a long time).
3.1. PDF-XChange Editor (recommended)
Unfortunately, you can't add OCR layer, use command-line interface. You can use some PDFXEdit commands, but for OCR actions GUI required.
Download this program (Chocolatey installation supported) → download pack for your language(s) if needed → add OCR to your PDF; settings in my case:
3.2. Convert to image and vice versa
You can convert your PDF to images → Tesseract will add OCR for your images and will convert images to PDF. Use this script for it:
pdftoppm -jpeg KiraSuperhero.pdf KiraSuperhero
for %i in (*.jpg) do tesseract %i KiraOutput/%i -l rus+eng pdf
sejda-console merge -f *.pdf -o KiraSuperheroFinal.pdf
- For simplyfying I don't added additional options or commands for better quality and compression, but it would be nice do add it.
- I don't know, how question author was going to use the CLI programs and I don't saw his examples; maybe in his cases it would be nice use another commands.
For details about this script, please, read section below “Commands description”.
4. Commands description
- Install Poppler for Windows (I add request, that Chocolatey installation will possible) — pdftoppm is Poppler part.
- pdftoppm of XpdfReader is another utility with fewer options; please, do not confuse Poppler and XpdfReader versions.
- pdftoppm options list. Pay attention to
-jpegopt, that set quality of outputed images.
- If your PC haven't required fonts, pdftoppm show it. You will need to download fonts from Internet or use fallback fonts.
- Converting to TIF doesn't worked for me; convert your PDF to JPG. See my bugreport for details: bug(pdftoppm): -: Error writing TIFF header..
- Windows installation; request, that Chocolatey installation will be possible.
- Command Line Usage.
- Searchable PDF output.
- How to run Tesseract with multiple languages one time?
- How to tesseract multiple files in the same folder from command prompt?
- Tesseract doesn't support reading PDF files directly; converting to images required.
- I create
KiraOutput directory and set is as Tesseract output directory, so that the source file
KiraSuperhero.pdf will not merged to
KiraSuperheroFinal.pdf in next stage.
4.3. Sejda Console merge
- Download and unzip sejda-console archive from the latest release. Request, that Chocolatey installation will be possible.
sejda-console merge -h for
merge command options list;
sejda-console -h — for all sejda-console options.
- If you need correctly merge PDF's, filenames of which is numbers without leading zeros (for example,
014.pdf), please, read this my Software Recommendations answer.
PDF-XChange Editor and Tesseract incorrect or doesn't recognize black symbols on grey background. For example, see page 10 of
KiraSuperheroPDFXChange.pdf (file from section “PDF-XChange Editor (recommended)” of this answer):
Symbols inside red rectangle doesn't selectable.
I need edit this PDF page for correct OCR; see “Note” section of this answer for details.
5.2. PDF-XChange Editor
I can't use Russian language in version 8 and need downgrade the program. See my bugreport:
5.3.1. Selected area
See example PDF, created by tesseract: words selected not completely:
I reproduce this problem for any language. See my bugreport:
5.3.2. non-English languages
Tesseract can have strange output for non-English languages. See my bugreport:
6. Not suitable for requirements
Requirement 2 of question is
Windows native application. I think, tools below don't meet this requirement:
For this software Windows Subsystem for Linux or Docker required (ocropy, OCRmyPDF (pip version doesn't supported for Windows users)). IMHO, programs with this hard dependencies can't be considered “Windows native application”.
7. With bugs
In this section programs with critical bugs for my tasks.
k2pdfopt is multifunctional tool with Tesseract-based (GOCR also support) OCR feature. This program allows convert PDF to PDF with OCR without intermediate steps. You can try k2pdfopt, but keep in mind, that it add to PDF Cyrillic symbols incorrectly. See my bugreport:
7.2. Sejda Console pdftojpeg
Sejda is powerful open source SDK for operation to PDF files. pdftojpeg have better conversion from PDF to images, than pdftoppm (see “pdftoppm” section), but have critical bugs:
For bilingual documents words can converts incorrectly:
Images doesn't display in outputed JPEG:
8. Not recommended
8.1. Obsolete OCR software
See Wikipedia article Comparison of optical character recognition software for a complete picture of what OCR programs exist:
I don't review in my answer obsolete, not updated for a long time software as Puma.NET and CuneiForm.
GOCR (…) faster than Tesseract by more than a factor of ten, but Tesseract is far more accurate and still reasonably fast (~25 words per second on a modern PC) and also supports multiple languages (GOCR only supports English / ASCII). Because of this, I decided to make Tesseract the default.
Popular answer to question “How to convert PDF to Image?” is ImageMagick. Maybe you will get better results, but I had a bad behavior.
I tried convert to images full version of my book (317 pages, 18 MB). I ran this command:
magick -density 300 KiraSuperhero.pdf %d.tiff
My PC with 8 GB RAM hangs → I needed restart it. I reproduced the problem.
I read here, here and here → I set up environment variables → I ran this command:
magick -density 300 -limit memory 256MiB -limit map 512MiB -limit area 256MB KiraSuperhero.pdf %d.tiff
ImageMagick converted all pages very slow — for 2 hours. pdftoppm makes the same operation for some minutes.
As zuo user said:
pdftoppm is much faster than
This is a known problem, see ImageMagick forum threads: “High CPU load when converting images”, “Optimizing
Also, I'm not recommend ImageMagick for converting images to PDF. User Robert Fleming said:
ImageMagick decodes the JPEG, resulting in generation loss. Use img2pdf instead; it's also 10–100 times faster.
1 — for Windows use
magick command instead of
For OCR layer without (or with minimum) errors your PDF must have good quality. If no, improve quality. See links about it from official Tesseract wiki: