Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a good quality scan of a document; such scan is in pdf format.

How can I add ocr information to the pdf, so that it becomes searchable? By searchable I mean that the goal is that when viewing the pdf with evince, CTRL-F actually allows me to search in the pdf content.

share|improve this question
Duplicate?… – Jakob Jun 7 '12 at 9:04
@Jakob, I don't think it's a dupe, we are asking different things. The other question is about extracting text from some pdf (i.e. generating corresponding txt files), while my question is about modifying the pdf in order to add ocr information and make work the search function in the pdf reader. I'll clarify the question. – fdierre Jun 7 '12 at 10:17
How, and what did you use to scan the document? – Mitch Jun 7 '12 at 11:05
@Mitch I used my office Ricoh Aficio MP-C2500 printer/copier/scanner, which has a very nice document feeder. :-) – fdierre Jun 7 '12 at 12:06
Scanning and/or OCR Software? – Mitch Jun 7 '12 at 12:18

There are two projects which do the trick: GScan2PDF and OCRFeeder

share|improve this answer

I found a non-ideal solution, but a very effective one.

I use PDF X-Change Viewer through Wine. It has an OCR feature which adds a text layer to the existing image-based pdf.

Thus you can search and copy text from this invisible layer.

enter image description here

share|improve this answer

pdfsandwich does what you want and provides Ubuntu deb packages. It uses tesseract as OCR engine. The following call adds the text layer to your scanned pdf:

pdfsandwich scanned.pdf

Disclaimer: I'm the developer of pdfsandwich and therefore obviously biased.

share|improve this answer
This is really great, thank you. However, it appears to modify the images, looks like it runs an unsharp mask over them or something. Is there a way to leave the images exactly as they previously were? In my particular instance, the filter even managed to remove the bar from a couple of fractions in some equations. Everything else works pretty well though... – naught101 Feb 9 '15 at 2:47
Bad quality package: `Lintian check results for /tmp/pdfsandwich_0.1.3_amd64.deb: E: pdfsandwich: control-file-has-bad-permissions md5sums 0664 != 0644 E: pdfsandwich: control-file-has-bad-owner md5sums james/james != root/root E: pdfsandwich: wrong-file-owner-uid-or-gid usr/ 1000/1000 E: pdfsandwich: wrong-file-owner-uid-or-gid usr/bin/ 1000/1000 E: pdfsandwich: wrong-file-owner-uid-or-gid usr/bin/pdfsandwich ... – A.B. Apr 22 '15 at 5:55

For a command line solution, you can use pdfocr.

In brief, install software:

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:gezakovacs/pdfocr
$ sudo apt-get update
$ sudo apt-get install pdfocr

Then run pdfocr:

$ pdfocr -i scanned.pdf -o

That worked for me on Ubuntu 12.04 LTS.

share|improve this answer
Github here: But this has the same issue as pdfsandwich, as it modifies/compresses PDFs containing highres images, basically destroying some of the original image information. – jmiserez Mar 21 '15 at 18:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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