If I understand your post correctly, its called Optical Character Recongnition (OCR for short). It's not trivial, as a quick web search on the topic would suggest.