OnDevice OCR Pro

Guide

Extract Invoice Number from PDF
and Use as Filename

Guides

Name and Sort Files

How to extract the invoice number and insert it into the finished file name.

You can download OnDevice OCR Pro for free from the Mac App Store and test all features. The only limitation is a watermark in the output files.

To demonstrate automatic file naming, we use this fictitious invoice in this example.

Option 1: Suggestions from the Document

  1. Drag one or more invoices into the OnDevice OCR Pro window.
  2. Click “Name Files” → “New Template”.

    With a single file, the switch is called “Name File”. Your files automatically serve as sample files.

  1. Remove the “Original Name” component by clicking the “x”.
  1. Click the “Custom Text” component, enter “Invoice”, and confirm the name with the Return key. Then add a “Space” by clicking that component.

    The preview already shows you what the future files would look like.

  1. Click “Suggestions from the Document” and then “Invoice No.”.

    In this case, OnDevice OCR Pro analyzes the selected document to find the terms it contains along with their associated values. If the term you are looking for is not included, you can enter it explicitly as described in Option 2 and have the app search for it.

  1. You now see the invoice number that was found and can check whether it was found correctly.
  2. Now click “Add”.
  1. Give the template a name and click “Save”.

You’re all set

You have now created your first custom template.

All files that you process with this template in the future and that have an invoice number will be named according to the pattern “Invoice invoice number.pdf”.

The invoice number here serves as an example of a changing value. It could just as well be a case number, a property number, a patient number, or something similar.

Of course, you can also combine several components – for example, to use the sender, invoice number, and amount in the file name.

Since all documents are processed and named exclusively locally on your Mac, the entire process is completely confidential.

Option 2: Search for your own terms

  1. Drag one or more invoices into the OnDevice OCR Pro window.
  2. Click “Name Files” → “New Template”.

    With a single file, the switch is called “Name File”. Your files automatically serve as sample files.

  1. Remove the “Original Name” component by clicking the “x”.

    Original Name = the original file name before naming.

  1. Click the “Custom Text” component, enter “Invoice”, and confirm the name with the Return key. Then add a “Space” by clicking that component.

    Custom Text = a fixed name of your choosing that all files with this template receive, e.g. “Invoice”.

  2. Click “Value from Document”.

  1. Now enter all spellings of the invoice number that appear in your invoices (e.g. “Invoice number, Invoice no.”), separated by commas.

    By specifying several spellings, extraction also works on different documents.

    Optionally, you can specify the position and length of the value.

  2. Confirm the entry with the Return key.

  1. The preview now shows you how the selected document would be named after processing.

    All files that you process with this template in the future and that have an invoice number in the document text will be named according to the pattern “Invoice invoice number.pdf”.

  2. Now give the template a name and click “Save”.

You’re all set

Your template is now ready to use. Whenever you process documents – whether via folder monitoring, in the processing window, or through Apple Shortcuts – you can now select it for naming.

Extract invoice numbers automatically – with OnDevice OCR Pro.

Download on the Mac App Store

Compatible with macOS 14.6 and later.