If you want to do this in Acrobat's JavaScript, be prepared for some serious scripting - and even with that, it may not possible to solve this problem at all, depending on the exact requirements.
First, after scanning (or as part of the scanning process), you need to run OCR (optical character recognition) so that Acrobat can actually extract (or find) text in the document.
Once you have text that can be extracted or searched for, you can then run a JavaScript that does the following:
- Crop the page to the area in which you expect the number to be.
- Use the JavaScript function Doc.getPageNthWord() (Acrobat DC SDK Documentation) to loop over all "words" in the crop area. This will very likely give you the number you are looking for.
- Reverse the crop from the first step to have the whole page again. This is where it gets tricky, because you actually need to store the difference you applied in the first step, and reverse that exactly.
- Repeat this for any other area you are interested in.
When you look through the archives of this forum (and over at http://acrobatusers.com - e.g. this one for how to reverse the crop box back to the whole page: Reverse Crop With Javascript (JavaScript) ), you should be able to find all the parts you need to create such a solution.
Keep in mind that this all depends on the quality of the scan. If Acrobat cannot recognize text because of low scan quality, then there is nothing you can do. Also, one problem with scanned documents is that there may be too much variation in the location of the text objects you are interested in. There is another API function, that gives you the location of a "word" (Doc.getPageNthWordQuads - Acrobat DC SDK Documentation) - you could use that to search for known text on the scanned page to calibrate your text finding algorithm.