preview – Keep copy/paste and TOC in PDF converted from ebook?

For research, I often convert non-DRM ebooks to PDF using Calibre. The resulting PDF has a TOC with working links. However, it is not searchable in Preview, and copy/paste results in blank white space, even when pasting into TextEdit or nValt.

(Adobe Acrobat can search, copy/paste the PDF and the TOC works, but I use many tools that use Apple’s PDF frameworks, so I’d like to solve this.)

To make it searchable and copyable, I run the PDF through Ghostscript using these commands:

gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=”output” “input”

This renders a new PDF that is searchable, and copy/pastes properly. However, it strips the links from the TOC.

Is there a way to convert the PDF so that it will retain its TOC links and also be searchable and have copy/paste work?