16

The goal is to automatically convert all scanned documents into searchable PDF files instead of just images. The scanned documents are automatically uploaded by the scanner to a share on a Linux server as PDF files.

The software should be able to monitor the folder and automatically OCR the scanned documents and add the recognized text to the PDF file to make it searchable. It should also be able to handle multi-page PDFs well.

Requirements:

  • Linux
  • Work automatically in the background without any additional manual steps
  • Being able to add the OCRed text back into the PDF in the proper way (so that desktop search engines will be able to index it)
  • Able to handle multi-page PDF files
5
  • I guess Adobe Acrobat/Omnipage + Wine or some VM is not an option? Apr 28, 2014 at 14:27
  • Do you need real-time monitoring or is just checking every X amount of time acceptable? Apr 28, 2014 at 14:42
  • 1
    @NickWilde Doesn't need to be absolutely real-time, if I can call it from a cron job that would be sufficient
    – user15
    Apr 28, 2014 at 14:43
  • Also I'd recommend not overwriting the originals - if the OCR messes up it is better to have them; would renaming the original to %name%.bck.pdf or similar be okay for your users? Apr 28, 2014 at 14:44
  • I use Microsoft OneNote as OCR tool. On Right click against an image It can copy the entire text in images and It also has the capability to search text with in image. It is free and accurate and runs on windows and support almost all image formats. I am not sure if it works in Ubuntu or not through Wine, as Microsoft Office is now available for Mac OS, OneNote will work on it. But it doesn't do it automatically you have to add file into OneNote workbook. It Searches multi page PDF's. Bonus point is that it supports multiple languages :) English, French, Spanish also Jul 23, 2015 at 11:29

2 Answers 2

1

OCRmyPDF
Website: https://github.com/jbarlow83/OCRmyPDF
License: MIT License

OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched

0

pypdfocr
Website: https://pypi.python.org/pypi/pypdfocr
License: ASL 2.0

I wrote a pretty simple way to search all pdfs that are not already OCRed and OCR them.

I noticed if a pdf file doesn't have any font it is usually not searchable. So knowing this we can use pdffonts.

First 2 lines of the pdffonts are the table header, so when a file is searchable has more than two line output, knowing this we can create:

gedit check_pdf_searchable.sh

then paste this

#!/bin/bash 
#set -vx
if ((`pdffonts "$1" | wc -l` < 3 )); then
echo $1
pypdfocr "$1"
fi

then make it executable

chmod +x check_pdf_searchable.sh

then list all non-searchable pdfs in the directory:

ls -1 ./*.pdf | xargs -L1 -I {} ./check_pdf_searchable.sh {}

or in the directory and its subdirectories:

tree -fai . | grep -P ".pdf$" | xargs -L1 -I {} ./check_pdf_searchable.sh {}

Your Answer

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