83

I'll tell you clearly and loudly: I don't like Calibre! So, how can I convert PDF to ePUB without it?

0

6 Answers 6

116

We know you don't like Calibre... but have you tried its CLI conversion tool?

The Calibre install provides the command ebook-convert that will handle what you want, and there's no need to run Calibre.

ebook-convert file.pdf file.epub

is all that's required.

If the output looks a little wrong - try this

ebook-convert file.pdf file.epub --enable-heuristics

It will try a "smart" way to convert. Not perfect, but can work well in most conversions.

7
  • 2
    Any way to make it work with 2 column documents? The --enable-heuristics flag does not work well with those.
    – zakkak
    Commented Nov 20, 2014 at 15:55
  • 2
    According to their website, multi-column PDFs are not supported.
    – Drac Noc
    Commented Dec 23, 2014 at 17:13
  • 6
    Wow thanks. For multiple PDF files within a folder I used this after cding to the directory: find ./ -iname "*pdf" -type f | while read f; do echo -e "\e[1mConverting file $f \e[0m" ; ebook-convert "$f" "${f%.pdf}.epub" --enable-heuristics ; done
    – Wilf
    Commented Apr 24, 2015 at 12:14
  • 1
    note that if you don't have the ebook-convert command, you may have installed calibre through flatpak or snap. Uninstall your existing calibre through the software center, or flatpak remove, or snap remove and then install with apt
    – Ace.C
    Commented Apr 11, 2019 at 6:16
  • 1
    @PrashantTapase - I don't see why you should have any trouble. The GUI offers the same options as the CLI. The GUI has more of a per-device set of rules. You can opt on how files are converted when they are transferred according to what reader you plugged in. A Kobo reader uses epub, Kindle has mobi. Calibre should pick that up automatically, but you can always use the convert icon to fine tune what you have in your library.
    – Drac Noc
    Commented May 3, 2019 at 18:00
14

LibreOffice has an epub exporter extension, so you can install the LibreOffice PDF importer extension, import your PDF, and then export to epub.

0
4

Have a look at www.convertfiles.com, you can easily convert .pdf to .epub using their free online conversion tool.

1

This is not a direct answer to the question, but for people who want to read PDFs on an e-reader and are finding it cumbersome, one solution may be to crop the margins of the PDF, and read in landscape mode. That works acceptably well for me on my e-reader in any case. There are many PDF croppers out there. Just search for "pdf crop" or "pdf trim".

1

I've managed to cut out ebook-convert from Calibre (which, for who knows what reasons, requires Qt for image manipulation) and got a command-line only interface for it, to be able to use the tool on a headless/server machine.

The steps involved extracting these directories from the calibre package (deb, rpm, whatever):

/usr/bin/ebook-convert
/usr/lib/calibre
/usr/share/calibre

Installing some missing python modules (which you figure out by running the convert command ebook-convert inputfile outputfile), in my case:

python3-msgpack
python3-dateutil
python3-lxml
python3-css-parser
python3-pil

etc.

I also had to specify a command line option --mobi-keep-original-images, since I wanted to convert epub to mobi format using: ebook-convert ~/test.epub ~/test.mobi --mobi-keep-original-images

The last part was the most painful, since it involved modifying some of the python util scripts, which use Qt (which then requires some X11 libs) for image manipulation and we want to avoid that on a server/headless machine. Basically, I removed Qt imports and fixed the remaining errors in the scripts by making those functions empty (or throw an exception) in these 2 files (in my case):

/usr/lib/calibre/calibre/utils/img.py
/usr/lib/calibre/calibre/ebooks/conversion/plugins/mobi_output.py

In short, the conversion tool only uses Qt for image manipulation operations. If you can live with unmodified images from the original book that you are converting and don't need to compress/resize those images, then you're lucky, since you can avoid using Qt/X11.

Note to calibre developers: Why did you not use standard image manipulation libraries? Why choose a heavy GUI-oriented framework (like Qt) for simple image operations? Quite a great package (calibre) with such a poor decision, in my opinion...

0

2epub.com - the same online converter with batch processing and output compression files

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .