I have a programming book in EPUB format and I'm trying to convert it to TXT. For that I'm using the utility ebook-convert from calibre. The problem is that the standard usage:
ebook-convert book.epub book.txt removes indentation in source code samples. E.g. a sample in the book looks so:
class A { private int a; } But in the resulted TXT:
class A { private int a; } After reading the utility's man page I've tried the following options:
--keep-ligatures --pretty-print --change-justification=original but with no result. How to achieve it?
$ locale LANG=en_US.UTF-8pdftotexthas-layoutoption to keep original formatting of a PDF in TXT.links -dumpor similar. if that doesn't work either you might have to have a look at the HTML directly and write your own helper script for converting the code snippets.