I recently downloaded a programming book. All pages are in image format. If I want to run a code, I'm unable to copy it from that ebook. How to convert these kind of pdfs to normal pdf. I google but I didn't understand what they are saying. They are telling about some OCR and something which I can't understand. Is there any tool or software for it.(I'm using windows and linux (ubuntu) operating systyems)
It sounds like the pages you've looked at are telling you the right thing. If you have an image-based PDF, then there is no text in it, just pictures of text. In order to convert the pictures of text to actual text, you have two options: have a human do the conversion, or have the computer do the conversion. Having a human do it would mean someone sitting down and typing out your book for you. Having the computer do it for you involves Optical Character Recognition (OCR) software. If you have Adobe Acrobat (not Adobe Reader), it has built-in OCR software. Other than that, I know that ABBYY Fine Reader has an excellent reputation. There may be other options as well.
Bear in mind that whatever OCR software you use, the conversion will not be perfect, particularly if you're dealing with a bad scan. Even in a best-case scenario where you've got 99.9% accuracy on the conversion, you'll still have about one error every thousand characters—two or three typos per page. That will mean that you'll have to be careful cutting and pasting code; the whole process may not save you any effort over just typing stuff in.
Open your PDF file in Google Chrome and use Project Naptha extension to select and copy text.