Slighly modified version of doc orc/parser by Simon Willison (https://simonwillison.net/2024/Mar/30/ocr-pdfs-images/)