Easiest way to convert a PDF to EPUB for free on a Macintosh?

1. Open the PDF in Preview.app, Edit>Select All, right click selection and Copy.
2. Open Pages.app, Edit>Paste.
3. Do any minor edits.
4. Export as EPUB (You will have other output options as well).
5. For further tweaks get Sigil.

Don’t spend weeks writing code to do this only to find that a complicated PDF is such a pain in the ass to work with that you need to buy a book to help you figure it all out while knowing deep down it will never be perfect anyway! Certainly don’t spend any money to do this shit when simple tools can do it for you.

If you just want a great reader, get Skim

Also see-

GhostScript

Python PDFMiner

iText