How to detect text from the image and pdf in javascript/python?

If i have an image which contains the set of characters or paragragh or handwritten words or screenshots.
How can extract the words from the images

I need to retrieve the words from the image/pdf fro correctly pronounciation of the words