But back to the topic of OCR... How does these document scanners and OCR's plan to deduce this kind of source written in the margins?
I have no idea; probably they don't, yet. Everything I've worked on uses students' eyeballs to do the actual character recognition, so I'm not deeply familiar with the state of the art. I do know that OCR is mainly used for documents that have a well-defined structure where you can make an image map identifying different semantic fields, and the contextual field information allows for much more intelligent OCR; it's not so good for big blocks of paragraph text.
When you get to figuring out stuff scrawled in the margins, there are image pre-processing techniques that can identify regions of handwriting and then normalize it by rotation and scaling, but I'm pretty sure a complete solution is still in the realm of stuff considered AI (because, of course, once you know how to do it reliably, it becomes machine learning or pattern matching or something like that and no one calls it AI anymore).
When you get to figuring out stuff scrawled in the margins, there are image pre-processing techniques that can identify regions of handwriting and then normalize it by rotation and scaling, but I'm pretty sure a complete solution is still in the realm of stuff considered AI (because, of course, once you know how to do it reliably, it becomes machine learning or pattern matching or something like that and no one calls it AI anymore).