OnDevice OCR Pro

Ollama Integration

Rename PDFs and Invoices on Mac
Automatically with Local AI

Name documents and invoices automatically with local AI — offline and privacy-friendly.

Introduction

When you file your invoices, receipts, and other personal documents after text recognition (OCR), they often end up with names like Scan_001 and so on. Since meaningful filenames are almost as important as searchable PDFs, this tutorial shows you how to create your own naming templates in just a few minutes using the free open-source app Ollama and OnDevice OCR Pro, so your scans also get fitting names right after text recognition.

You can also download OnDevice OCR Pro for free and test it fully with a watermark.

Instead of “Scan_001”: this is how local AI names your documents automatically.

To demonstrate naming with Ollama, we use this fictional annual statement in this example.

Step 1: Installing Ollama

  1. Download Ollama from the official website ollama.com and drag the app into your Applications folder. (Direct download)
  1. Open Ollama and start the setup by clicking “Continue”.
  1. Click “No thanks, I’ll use Ollama locally” so that, as we recommend, your personal documents are processed only locally on your Mac.

    Signing in gives you access to cloud models such as gpt-oss and others in addition to local AI models. If you do decide to use cloud models, choose only providers you trust, and don’t process any sensitive personal documents.

  1. Open the “Terminal” app on your Mac.
  2. To download your first local AI model for automatic file naming, type the command ollama pull gemma4:12b in Terminal and press Return. Ollama then downloads the model to your Mac.

    “gemma4:12b” is just one possible model. You can of course enter a different model name.

  1. As soon as the download is complete and “success” appears, the AI model is ready to use.

Step 2: Setting up OnDevice OCR Pro

  1. Download our app for free from the App Store or from our website and install it.
  2. Open OnDevice OCR Pro and click “Settings” → “Integration” in the top right corner.
  1. In the Ollama section, click “Connect”.

    Make sure Ollama is still open. You can tell by the llama icon in the menu bar at the top of the screen.

  2. Now click “Close” at the bottom and drag the document you want to create a naming template for into the app window.
  1. Click “Name File” → “New Template…”.
  1. Now delete the “Original Name” component by clicking the “x”.

    The preview shows you in real time, using the selected document as an example, how future documents you process with this template will be named.

  1. Now click “Search an Area in the Document…”.

    In this guide, we focus on analysis with local AI and leave out the other features.

  1. Under “Method”, choose the model you downloaded earlier, “gemma4:12b”, and next to “Uses” on the right, click “Text + Image”.

    If Apple Intelligence is available on your Mac and turned on, you’ll see it in the list of available AI models as well.

    When “Text + Image” is selected, the AI gets not only the recognized text but can also see that section of the document.

  1. First, extract the date. To do this, zoom in on the document slightly with your mouse’s scroll wheel or your trackpad, then click and drag to draw an area in the top right corner of the document where the date is.
  2. Now, in the “Instruction” field, give the AI model the “prompt” to extract the date. To do this, enter “Return only the invoice date” and then click “Evaluate now”.
  3. Under “Found”, you can see right away whether the AI carried out your prompt correctly. If it did, give this component a name and click “Done”.
  1. The first component, “Invoice date”, has now been created. In the filename preview, you can already see what this file will be named.
  2. Now click the “+ Space” component first, and then click the “Search an Area in the Document…” component again to extract the other values.
  1. Go to “Method” → “gemma4:12b” again and once more drag with your mouse to select an area on the document.
  2. This time, enter “Return only the sender's company name” as the instruction. Enter “Sender” as the name and then click “Done” again.
  1. The preview now already contains the invoice date and the sender.
  1. Finally, enter the prompt “Return only the document type and the year” and then give the template a name.
  1. Click “Save” and select the new template in the template window.
  1. Finally, you can run text recognition with the naming template on similar documents to see whether it also works on other documents in practice.

All set

That’s how easy it is to name documents automatically with Ollama and OnDevice OCR Pro. As a next step, you can create rules: when text recognition finds certain words in a document, the document is named with the matching template right away — and filed immediately in the folder you want. → Invoices aren’t just named as invoices, they’re also saved straight to your Invoices folder.

You can use the naming and sorting feature everywhere: in Apple Shortcuts, in the processing window, through the Finder integration, and in the watched folder, where new files are processed in the background as soon as they arrive.

Curious? Download OnDevice OCR Pro for free and try out this feature and many others with no obligation.

FAQ

Frequently asked questions about naming with local AI

Do my documents really stay on my Mac?

Yes. Ollama and the AI model run entirely locally; the AI analyzes the document directly on your Mac. However, if you sign in to Ollama and deliberately choose a cloud model, data is sent to that provider.

Which AI model should I use?

gemma4:12b is a good starting point for invoices and letters. Smaller models like gemma4:4b respond faster and need less memory, but make more mistakes with harder requests. Since things are moving so fast and new models come out every week, it’s always worth checking what’s current.

How long does naming take per document?

On a current Mac with Apple silicon, it takes about 5–10 seconds per component, so a filename made of three components is ready in roughly half a minute. The first request usually takes longer because the model first has to be loaded into memory. These figures are averages and can vary widely depending on your Mac’s performance and the size of the model. Start with small models to get to know what your system can do.

Can I use just Apple Intelligence instead of Ollama?

Yes. If Apple Intelligence is available on your Mac and turned on, it appears right in the model selection, and it works exactly the same way as the other local AI models you access through Ollama. For Apple Intelligence, however, we recommend macOS 27 or later, since its models AFM 3 Core and AFM 3 Core Advanced are not only much more capable than before but can also interpret images. When analyzing layouts, that’s a decisive advantage.

Does this also work with hard-to-read scans or handwriting?

With the “Text + Image” option, the AI sees the marked area itself, not just the recognized text. This helps it interpret faint scans and stamps. Because so many factors are involved (font, quality, size of the AI model), there’s no reliable general answer here.

Can naming run automatically for all new scans?

Yes. With rules, OnDevice OCR Pro picks the matching template on its own based on the words recognized in the document. For example, if “electricity contract” or “invoice” is found in the scan, the right template is selected right away. Combined with a watched folder, new PDFs and files are automatically recognized, named, and filed in the background — and the same works through the Finder integration and Apple Shortcuts.

For general questions about pricing, languages, features, and system requirements, see the FAQ on the homepage.

Make your documents searchable — starting today.

Download on the Mac App Store

Requires macOS 14.6 or later.