Convert EPUB to PDF using Calibre for text-to-speech in the PDFSpeech app

Calibre does a fantastic job of converting an EPUB to PDF. The PDF looks beautiful.

However, the generated PDF does NOT have selectable text in Preview (or PDFSpeech.) This is because Calibre generates a PDF that is beyond the capabilities of Preview’s built-in PDF engine.

The fix is simple though requires a bit of work in the Terminal app.

First, install the ghostscript command-line utility using Homebew - follow the steps here:
This is a one-time installation.

Then, in Terminal, cd into the Calibre book directory which contains the generated PDF.

Run these two commands where target.pdf is the PDF generated by Calibre:

alias fixpdf="gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=new.pdf"
fixpdf target.pdf

This will create a new PDF named new.pdf in the same directory.

The alias is not necessary - you can issue the gs command (for ghostscript) directly if you wish. The alias is useful if you’re going to be fixing several PDFs generated by Calibre (each in their own book directory.)

Move and rename new.pdf as required.

Drag the new PDF into PDFSpeech to read through it quickly using text-to-speech.

Source for the tip: