I have seen other similar posts, but none with these specific requests:

  • OCR application that can be run from the command line
  • Windows native application
  • Accepts multipage PDF inputs
  • Can create a PDF file as output with an invisible text layer
  • Free

Can anyone provide suggestions?

Other software that I've researched that came close but not exactly what I was looking for: Tesseract (does not seem to accept PDF input files), OCRmyPDF (only Linux/UNIX/macOS supported), TrackerSoftware PDF-Tools (not free).

  • Doug, how I add OCR to my scanned books. // 1. I convert PDF to TIF, use free version of PDF X-Change Editor // 2. I add OCR to all files and save them to PDF via Tesseract command for %i in (*.tif) do tesseract %i out%i -l rus pdf // 3. I merge PDF files to single PDF. See my example PDF with OCR layer. Thanks. Commented Aug 15, 2019 at 14:02
  • Doug, Type: Note When I started editing PDF, I understood for myself, that I need convert PDF to image and backward; not edit PDF directly. Besides Tesseract convert PDF to images required, for example, if you want remove background or use a lot of ScanTailor Advanced editing features. Thanks. Commented Aug 15, 2019 at 14:12
  • Thanks Cawa. Can you post your example on something public (not Box)? I can't access it.
    – Doug
    Commented Aug 16, 2019 at 14:58
  • Doug, sorry for late answer. I wanted to write a quality answer: I was looking for information and sent 10 bug reports and requests to software developers on your problem. For this I needed time. Thanks. Commented Aug 20, 2019 at 13:50

1 Answer 1


1. Summary

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.

2. Disclaimer

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.

3. Suggestions

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:

X-Change Editor settings

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
mkdir KiraOutput
for %i in (*.jpg) do tesseract %i KiraOutput/%i -l rus+eng pdf
cd KiraOutput
sejda-console merge -f *.pdf -o KiraSuperheroFinal.pdf

Result — KiraSuperheroFinal.pdf.


  1. For simplyfying I don't added additional options or commands for better quality and compression, but it would be nice do add it.
  2. 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

4.1. pdftoppm

  1. Install Poppler for Windows (I add request, that Chocolatey installation will possible) — pdftoppm is Poppler part.
  2. pdftoppm of XpdfReader is another utility with fewer options; please, do not confuse Poppler and XpdfReader versions.
  3. pdftoppm options list. Pay attention to -r and -jpegopt, that set quality of outputed images.
  4. If your PC haven't required fonts, pdftoppm show it. You will need to download fonts from Internet or use fallback fonts.
  5. Converting to TIF doesn't worked for me; convert your PDF to JPG. See my bugreport for details: bug(pdftoppm): -: Error writing TIFF header..

4.2. Tesseract


  1. Windows installation; request, that Chocolatey installation will be possible.
  2. Command Line Usage.
  3. Searchable PDF output.
  4. How to run Tesseract with multiple languages one time?
  5. How to tesseract multiple files in the same folder from command prompt?


  1. Tesseract doesn't support reading PDF files directly; converting to images required.
  2. 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

  1. Download and unzip sejda-console archive from the latest release. Request, that Chocolatey installation will be possible.
  2. Run sejda-console merge -h for merge command options list; sejda-console -h — for all sejda-console options.
  3. If you need correctly merge PDF's, filenames of which is numbers without leading zeros (for example, 4.pdf, not 004.pdf; 14.pdf, not 014.pdf), please, read this my Software Recommendations answer.

5. Problems

5.1. Both

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):

Grey on black

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. Tesseract

5.3.1. Selected area

See example PDF, created by tesseract: words selected not completely:

Tesseract selected area

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.

7.1. k2pdfopt

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:

  1. For bilingual documents words can converts incorrectly:

    Sejda Bilingual

  2. 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.

8.2. GOCR

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.

8.3. ImageMagick

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 convert¹

This is a known problem, see ImageMagick forum threads: “High CPU load when converting images”, “Optimizing convert speed”.

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 convert

9. Note

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:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.