Hmmm, I'm not understand you well; do you say that you are making an epub file from a .pdf of "How to Think Like a Computer Scientist"? If so, then why aren't you making it from the .html version?

Of that way you can get the epub practically with copy and paste. Of course, you'll have to polish a bit the things (especially with images) but you'll be able to get that book in epub format quite fast.