ocrmypdf/OCRmyPDF ? reverse-engineered prompt

Reverse engineered prompt

I need a Python command-line tool to process my scanned PDF files. A lot of my documents are just images inside a PDF, so I can't search for text or copy-paste anything, which is really frustrating.

The tool should take a PDF file as input, add a text layer using OCR, and save a new, fully searchable PDF. It should also be able to take an image file and convert it into a searchable PDF. Please make it smart enough to automatically fix pages that are crooked or rotated sideways. It's really important that the text it finds lines up correctly with the image so copy-pasting is easy and accurate.

I'd also like it to optimize the final PDF and try to make it smaller than the original, without reducing the image quality. It needs to support multiple languages, even in the same document. I've heard Tesseract is a good OCR engine for this. Make sure the script is fast by using all available CPU cores.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab