Converting photos to PDFs

I would like to save some of my photos of documents / receipts to PDF (with OCR). On iOS, I can use apps like Adobe Scan and Scanner Pro. However, on macOS, I have only found a couple. Curious what others are using for this purpose. Thanks!

Preview will export a jpg as a PDF with a couple of mouse clicks. File → Export as PDF.

4 Likes

PS to my earlier reply: Preview will convert the image to a PDF, but it won’t be a searchable (i.e., OCR’d) PDF.

1 Like

Repository on Github that might help you out

JPG-to-PDF
Simple Python script to create a PDF file from a set of images within seconds.

Thanks @John_Shelburne, I’ll check that out. Looks like I will need to pre-crop the images before using the Python script. It doesn’t mention OCR, so will see if that is included.

Github has to have a tool that is open source that you can use. I will take a look this week because this is a really good idea and I need to probably convert a lot of my images to different format.

There’s a command line tool - OCRmyPDF

There’s also a similar discussion over on the KM forum fwiw

Thanks. What KM forum are you referring to?

1 Like

I’m curious. If you’re taking photos of documents, are you using your Mac camera, or are you using your phone? If the latter, the capability is built into the OS, I believe. Certainly multiple apps support this kind of thing with a very ‘plain, Apple-like’ interface.

Personally, I use KeepIt from Reinvented Software. I open it on my phone, hit the + button, and it auto-takes and squares up the photo, then lets me name it and choose a location (in KeepIt). KeepIt uses iCloud and therefore I have everything on every device with zero effort.

KeepIt also integrates into macOS so you can “Print PDF to KeepIt” or use the share sheet.

1 Like

The documentation for OCRmyPDF lists multiple different options for generating a PDF when you are starting with images. Note that all of these use command line tools.

  1. use Tesseract

    Tesseract is the underlying tool that OCRmyPDF uses for doing OCR. It accepts images as input. Therefore, if you are starting with images, you can just feed them directly to Tesseract and it will generate an OCR’d PDF. There is no need for OCRmyPDF to extract the images from an existing PDF and pass them to Tesseract. The downside is that you lose some of OCRmyPDF’s more advanced image cleanup features, but if you have good clean images to start with, that is probably not a concern, and this would be the simplest root.

  2. use img2pdf

    img2pdf is a third-party tool which OCRmyPDF recommends as a good tool for converting/combining images into a PDF document. It is favored because it is lossless (it does not degrade the image quality) unlike various other tools. You can then feed the output of img2pdf to OCRmyPDF for OCR processing.

    Of note is that while this is a command line Python script, it also does have an optional GUI for setting options etc. However, the GUI does not display input or output so it’s of limited usefulness.

  3. use OCRmyPDF

    You can feed an image directly into OCRmyPDF and it will output a OCR’d PDF. However, this will only work for a single image/page. If you need more than one page, one of the other options would need to be utilized.

The documentation mentions a few other options for converting images to PDF, but does not recommend them because they tend to degrade image quality, which would reduce the quality of the OCR output.

For those who prefer to avoid command line tools, I just noticed that the Tesseract documentation includes a list of GUI frontends which wrap Tesseract. Some of them only accept images as input while others accept PDF input. Some output text while other generate OCR’d PDFs. And they don’t all work on all platforms. However, there are many options listed. It is likely that one would work for your use case. I haven’t used any of them personally, so I can’t make any specific recommendations.

@zkarj, I use my phone to take the pictures. I usually use tools in iOS to convert to PDF, but occasionally I am at my Mac and want to do the work there rather than pulling out my phone. I know, kind of a first world problem…

1 Like