Tesseract now creates an .hocr file rather than an .html file for ocr output, but this is not exactly what is at issue here. When hocr2pdf uses this output it uses a large text size with small bounding boxes since the upgrade. Most of the text doesn't even appear in the resulting pdf, and what small amount of text does appear is unreadable and unselectable.

I'm using a script that goes through each .tif file in the directory and does the ocr on each one. I use a for loop like this:

for page in "$dir"/*page*.tif
    tesseract "$page" "$base" -l eng hocr
    hocr2pdf -i "$page" -o "$base.pdf" < "$base.hocr"

I also tried specifying the resolution with a -r 400 switch to hocr2pdf, but this did not result in any changes. I can only assume that the current version of tesseract is not producing appropriate output for hocr2pdf to work with.

Tesseract is my only ocr option because it handles Icelandic and Old Norse very well, so moving to another ocr tool is probably not a possibility.

1 Answer 1


One possible solution is to request PDF output directly from tesseract. This seems to provide better results for me than going through hocr2pdf.

tesseract "$page" "$base" -l eng pdf


tesseract "$page" "$base" -l eng -c tessedit_create_pdf=1
  • Thanks for the suggestion. I somehow recall not being happy with that output either for some reason, but it appears to be working now. From the Tesseract pdf output I get a blank space for each letter when highlighting the text in the stock Adobe reader for Ubuntu, Evince. However, on their github documentation page they say: "There may be nothing wrong with the PDF itself, but its hidden, searchable text layer may be not understood by your PDF reader."
    – user299889
    Jan 22, 2017 at 10:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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