Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to add OCR to PDF with OCRMyPDF

📅 2019-May-27 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ ocr, pdf ⬩ 📚 Archive

PDF files created by scanning pages or by printing or exporting from other file formats may not have a text layer. Without a text layer, every page is just an image on which you will not be able to search or highlight. The OCRMyPDF tool can be used to add an OCR text layer to any PDF easily.

$ sudo apt install ocrmypdf
$ ocrmypdf in.pdf out.pdf

I noticed that adding an OCR text layer increased the PDF file size by 1.5x! The tool also mentions at the end that this file size increase is surprising.

Tried with: OCRMyPDF 6.1.2 and Ubuntu 20.04


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧