5

Following up on how to OCR a pdf file and get the text stored within pdf? I have successfully produced OCRed pdf pages.

In Evince, however, the letters are not shown; by this I mean that I cannot see the characters, but I can select them, copy them and paste them elsewhere successfully. This does not seem to be a bug of Evince: https://bugzilla.redhat.com/show_bug.cgi?id=1364201

When initiating an OCR of a pdf page with pdfsandwich, tesseract produces a page that

contains a font which doesn't have any usable glyphs (they named it GlyphLessFont). It has only .notdef and .null replacements (the squares). Evince uses the .notdef glyph if there is no glyph for the character. The reason that Okular highlight the text is because it does it in the image not as a regular text as evince does.

pdftotext recognises the characters.

Now, the question is: can tesseract be told to use a different font?

3
  • Does pdftotext recognize the characters? (you may need to tweak character encoding)
    – grochmal
    Commented Aug 27, 2016 at 13:28
  • 1
    Short answer, no. More discussion: github.com/tesseract-ocr/tesseract/issues/1769 Commented Sep 21, 2020 at 3:18
  • @WeAreAllMonica pdftotext outputs recognizable characters now (at least as of 5.0alpha).
    – Geremia
    Commented May 7, 2021 at 21:53

1 Answer 1

2

You could customise this portion of the source code to your liking and change the font here. You will have to rebuild tesseract from source once you make the change.

Tesseract Github Renderer.h

1
  • thanks, but would you mind adding to your answer a bit more on how I would approach that? Sorry, am not a programmer, but can follow guidelines for rebuilding :) trying to understanding github.com/tesseract-ocr/tesseract/blob/master/CONTRIBUTING.md does not even help me much to decide how to suggest such a change as a feature request
    – ingli
    Commented Mar 24, 2017 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .