Apple's Preview has built-in Optical Character Recognition (OCR) since Sonoma
Nine months ago, I responded to this post:
Separate one sheet feed (scan) of student… - Apple Community
I provided the AppleScript/Objective-C code that would search for and capture a student ID and rename the associated PDF with that number. However, this code only works on PDFs with searchable text such as those created in an application and saved (or printed) to PDF.
Scanned documents simply place a PDF wrapper around an image of the scanned document content. These cannot be searched for text until they have had optical character recognition applied to them. That places exactly registered text above the image text and now they are searchable.
Since macOS Sonoma (14.*), Apple has included a feature in the export panel of the Preview application that performs this PDF OCR feature. Apple calls it embed text and it works just as well as the other OCR solutions (now unnecessary) I offered in the preceding linked post from last Fall. Apple's embed text appears to be language agnostic and handles German text as well as English.
The Preview PDF export panel on Sequoia (more abbreviated on Sonoma) looks like this:
where you choose an output PDF name different than the source PDF. Once you have exported, that PDF will respond to searches in Preview, or the AppleScript/Objective-C code from my prior post.
I should also mention that Apple's Image Capture application on Sequoia also now offers an optional OCR checkbox so the resulting PDF is searchable upon completion of the scan.
Mac mini (M4)