Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Epub.to – ePub to pdf, mobi, Kindle, and an API (epub.to)
246 points by nadermx on Feb 6, 2021 | hide | past | favorite | 89 comments



The comments are not mentioning [Pandoc](https://pandoc.org/) as an alternative yet (missing mobi I think).


If you're specifically converting eBooks, Calibre comes with command line conversion tools that produce better results than pandoc.


Calibre also has plugins that help ensure stuff like Goodreads works if you’re sending non Kindle books to a Kindle device.


It doesn’t run on iPad or iPhone… which is the niche these sites fill


I run calibre server on a raspberry pi which allows you to upload files and convert them via the web interface via my phone/tablet. You can even then download the new mobi/azw3 via the kindle browser (although the non JS version on my older paperwhite).


Someone should write a simple web app to use Docverter on iOS. Or just run a cURL tool or something. https://www.docverter.com


I have found the best tools for this to be the free Kindle Previewer ( https://www.amazon.com/gp/feature.html?ie=UTF8&docId=1003018... ) and Calibre. The Calibre editor is useful for cleaning up messed up EPUB files that don't work in the Kindle Previewer.


Calibre runs great in a container too. As always, the Linuxserver image is great. The Docker Package on Synology made this very easy when I was new to Docker some years ago, and it hasn’t been touched since the initial install, it just works.

https://github.com/linuxserver/docker-calibre


Shameless plug and this is only loosely related: Over the last holiday season I wrote a backend (written in Go and running on App Engine) to convert http url into epub. The frontend is a telegram bot that sends the epub to your reMarkable account directly, but it also has rest api to download the epub file: https://github.com/fishy/url2epub/blob/main/REST.md


Related to that, I made an app in Glitch to send RSS feeds as ePub to remarkable. It’s great it has an API. https://glitch.com/edit/#!/remarkable-sync-app


I want ePub to FB2. Because FB2 books are rendered with better readable fonts on my PockerBook reader.

I have no problems using Calibre or PanDoc for this task though. Obviously the problem emerges when you want to do the job without installing anything.


Why would you convert an epub to pdf? There is no ebook reader, other than kindles (for which the proper conversion would be to kf8), that can't handle epubs.


> Why would you convert an epub to pdf?

On the contrary! Why would you ever keep an epub file around? If somehow an epub file finds its way into my computer, the first thing that I need to do is to convert it to pdf to be able to read it with a reasonable viewer (or print it!). After the convesion, I delete the epub file; I really dislike this format and the associated software.


If you print your ebooks for some reason rather than buy used copies, granted you have to convert to pdf for that.

Why prefer an epub...

They have flowed text, and ebook readers let you customize font and font size so that the book's text adapts to you rather than you adapting to a particular combination of publisher quirks and zoom necessary to fit in a particular device's or app's viewable size.

They're generally smaller files.

And if there's something about the epub you don't like, you can actually fix it.

If a book is available in both PDF and epub formats, it's a reader's prerogative to pick the one they want, and there are specific types of books where PDFs might be preferable. However, if there's no original pdf, what is the objective of converting an epub to pdf in order to read it on a computer? Whatever you think you're accomplishing, I think you're mistaken. You end up with a pdf that looks exactly like how a typical ereader would display the epub. Minus the flowed text and font customizability, and probably with poorer navigation as well.


> Why prefer an epub...

Does epub support proper proper math notation typesetting?

Moreover, text in a webview doesn't flow as nice as vanilla TeX, and can look outright atrocious.


Converting an epub to a pdf adds nothing, only "fixes" your view to specific settings (font, etc.). You won't get better math typesetting that way, if it was missing in the epub.


Math epubs can be done properly using mathjax; equations can be written in typical TeX notation and rendered into MathML or SVG or various other targets.

Also, modern unicode fonts have good coverage of math symbols, so a lot of abstract math can be written inline without even resorting to mathjax. Algebra, set theory, and things like that.

I think the delay there is the many older ebook readers and apps that have quirks that require workarounds to get mathjax to work. Why bother, when publishers could just render equations to images or SVG and hardcode them? Mathjax just takes that rendering step out of the publishing pipeline.

Text flow... are you talking about inter-word spacing and rivers? My take on that is: full text justification was always a bad idea, only promoted for aesthetic reasons and to show off fancy layout engines that reduced rivers and other bad artifacts. It seems some publishers are doing away with it in new books. Poetry and plays rarely used it.


> Text flow... are you talking about inter-word spacing and rivers? My take on that is: full text justification was always a bad idea, only promoted for aesthetic reasons and to show off fancy layout engines that reduced rivers and other bad artifacts. It seems some publishers are doing away with it in new books.

I would say that mathematicians are extremely picky about the quality of their displayed formulas. Most of what can be produced by mathjax is not of acceptable quality. I speak about fine-tuning of kerning, alignement, etc. Having "reflowable" text is a nightmare for typography-inclined people: the flow is an essential part of the content and you do not want to lose it!


Everyone prefers better typography, but what qualifies as readable and acceptable for math? Generations of mathematicians learned from handwritten (including horrible scribbles on chalkboards), typewritten, and facsimile/photocopied material (like many Dover reprints). Current mathematicians grab scans of old math books from online pirate libraries. Math material on the web is mostly mathjax, and it's just fine. Math rendering doesn't have to be up to Spivak's standards to be just fine for reading and learning. And there's an even greater gap between "just fine" and "acceptable".

Back to the main points:

Epub is a better format for everything except niche uses (textbooks, especially math, papers, etc) where there's an argument for pdf. It's rather weak, but I understand the argument and I don't throw a fit when such material is only available in pdf. Most regular books aren't even published in pdf format anymore, for good reason.

There's no reason to convert epub to pdf except to print it — and why the hell would you do that? buy a used print copy — or to send to someone who doesn't have an epub reader — in which case you're better off giving them the name of an epub app to search for and install, so that they can read epubs in the future, rather than converting every epub you want them to read into poor quality pdfs.

Meanwhile, mathjax will only improve, along with publishers' general css competence.


Unless the text size is too large or too small on your device. I'll take accessability over finer points of typography any day.


Your comment makes no sense. If you want to read a math-heavy do and you stumble on unreadable text, your experience doesn't suddenly improve if you say "well at least I can get JAWS to play audio". There is no tradeoff.



You can bring in MathML into ePub with no problem. I guess your question then is “are there renderers that support MathML?” The answer to that is yes: Kobos have good MathML support.


Haha, I'm the opposite, i usually see a long text and wish I had it as epub.


Where are you downloading content as epubs that you can't get as PDF?


Fortunately, most stuff that I read is math-heavy thus unfeasible as an epub. Yet, there is the rare essay, interview or otherwise math-less text that comes in the annoying epub format that needs to be converted.


Different strokes for different folks, I guess. I do a lot of reading on a kindle and convert whatever I need using Calibre, but PDFs, because of their fixed formatting, are a bit of a nightmare.


So you're complaning about EPUB not supporting math notation, turns out

a) EPUB supports Math notations

b) you don't even have EPUB files where it's an issue.


I'm not complaining about anything; I'm actually happy that math texts are not usually distributed in epub so that I don't get to use those silly auto-reflowing viewers!


Because all PC epub readers suck (bad default margins, paddings, fonts, bad font rendering, lack of visual pages/sheets, etc)

I've tried to like them, customize them, fix their problems, etc but to no avail.


when I check the download stats for all my books, PDF downloads are more popular than all other formats.

I prefer epubs too, but apparently readers really like PDFs...


PDFs retain their formatting better and are much more readily accessible across devices, except for the smallest screens.


> PDFs retain their formatting better

Which is also its downside when formatting is not critical. I want to be able to change the font size and have the text reflow correctly. With PDFs you end up with broken layouts if you don't view it exactly as formatted.


>>I want to be able to change the font size and have the text reflow correctly. With PDFs you end up with broken layouts if you don't view it exactly as formatted.

Reflowable books also do a poor job reflowing content.

Case in point, the free AWS ebooks on kindle are a god-awful mess whenever they add code snippets, no matter how small.

Given the choice, a good fixed format layout beats a bad reflowable layout.


Especially as the choice of layout and elements like fonts is neither trivial nor unimportant, and a good readable code font is not easily replaced with $monospace_font_goes_here


Send my public domain book to my grandma who doesn't know how to handle an epub? Convert it because it is easier to print as a .pdf with my particular setup?

There are all kinds of potential use cases for users of differing levels of technical sophistication.

Why wouldn't you provide an option to convert to .pdf?


Nice tool. I thought kindle files were mobi? Any difference?


> A file with the .MOBI file extension is used for storing eBooks. It was originally a Mobipocket Reader format but has since been adopted by several different readers as well. Amazon purchased Mobipocket in 2005, and later discontinued the MOBI format in 2011.

> The current Kindle formats (AZW3, KF8, and KFX) are based on MOBI and is a proprietary format exclusively used on Kindle devices. And, in fact, you can still open files with the MOBI format directly on your Kindle

https://www.howtogeek.com/360419/what-is-a-mobi-file/

If you want to write a Kindle book, checkout my book, Publish Your eBook by Joel Dare.

https://www.amazon.com/Publish-Kindle-write-ebook-software-e...


The ones with DRM are .azw, basically an encrypted .mobi. Calibre is your friend. https://calibre-ebook.com/


And (another fun fact) if you want to email EPUBs to your kindle, just make the file extension .png (!?) and it will be automatically converted, without the need for Calibre.


Really!? This is the best tip I've heard in years. This will save me a lot of time when on the go (without access to calibre)


Although who knows why you'd want to go without Calibre when it's so multi-functional?


Most people HN would want it since we are power users who like desktop apps. But don’t rob yourself of trying to understand why everyone else doesn’t want to use desktop software to get a book on their Kindle.

For example, my girlfriend is an avid ebook reader but couldn’t be less interested in it. “I can see why that could be useful but... no thanks.”

We like the smell of our own farts too much sometimes. In this case, in the form of “why don’t people want to use more software to do what you were already doing without it?”


> But don’t rob yourself of trying to understand why everyone else doesn’t want to use desktop software to get a book on their Kindle.

Yes, that's a good point. I originally had "Why would you want to go without Calibre when it's so multi-functional?", but changed it to "Who knows why you'd want …" in an aim to sound less confrontational. I seem instead to have gone the other way!


I can download an epub on my mobile. I can email an epub from my mobile.

I can't run calibre from my mobile. I can rename .epub to .png and email that from my mobile.

Yes, I can host calibre somewhere else. No, my technologically savvy friends and family cannot. I also don't want them to depend on me to be able to convert an epub for their kindle when there's a trivial solution that doesn't require additional dependencies.


> No, my technologically savvy friends and family cannot.

There's a "less" missing in there, oops.


Because the only feature I've ever needed from Calibre is ePub conversion and Amazon will do that for me without hassle (and without access to desktop computer).


Kindle has jumped around in formats over the years. It's been AZW (which is basically mobi), AZW3, and now KFX. I assume that KFX is what this tool is calling "Kindle".


It currently does AZW3 for kindle, but I will add in the sub option to choose from those three formats.


Oh, that option being listed as "Kindle" is just there so people don't need to understand file formats currently? :D


just about, trying to make it easy to understand


There are a few "kindle formats"; the most basic of which are just mobi files. Generate a mobi file and any kindle should be able to load it fine.


I'd think I'll stick with the tried and true `ebook-convert` tool from Calibre, and pandoc. There's no sense uploading your documents to a third party when that's not necessary.


Can I use this to change my purchased kindle books into ebooks for all devices?

I’m somewhat tech literate, but pretty ignorant about e-book file types.


You cannot -- Kindle ebooks are in a format called KFX (or AZW/mobi or AZW3, depending on when you got them), which this tool doesn't support as an input.

If you wanted to do that, I'd just use Calibre, which has really comprehensive format conversion abilities: https://calibre-ebook.com

Most Kindle ebooks have DRM as well, which I think is currently hard to remove -- there's a plugin for calibre that you could try. Some publishers don't apply it, though, so maybe.


Calibre is great, but IMO it’s the wrong approach for this particular conversion. Use KindleUnpack instead, which is close to lossless.

https://github.com/kevinhendricks/KindleUnpack

This is a fantastic way to read books published by Tor on multiple devices. Now if only Tor would sell the ePub files on their website. (Tor eBooks are not DRMed.)


KindleUnpack doesn't seem to handle DRM though.


Neither does Calibre’s converter. To convert an encrypted AZW3 to an unencrypted EPUB, one can presumably decrypt it first and convert it second.


Calibre has a plugin the allows the converter to work with DRM


Removing drm from .azw3 is easy. [0] All you need is the ID of your kindle, since it's tied to your device.

There is also a plugin for Calibre, although I haven't tested this myself. I'm not sure if it requires a device ID or not. [1]

[0]: https://alexwlchan.net/2019/08/removing-the-drm-from-my-kind...

[1]: https://github.com/apprenticeharper/DeDRM_tools/wiki/Exactly...


I'm an author on Amazon and wonder: Is this also true if I switch off DRM for my books on Amazon? Could someone clarify this? I publish all my books without DRM.


So one thing I know is that for all the books by John Scalzi, their listings on Google Play Books have a note of:

    At the Publisher's request, this title is being sold without Digital Rights Management Software (DRM) applied.
(see https://play.google.com/store/books/details/John_Scalzi_Old_... for an example)

And indeed once you purchased his books you can download a DRM-free epub or pdf file of the book you purchased and use any tool you like to read it.

I don't see similar note on the listings of his books on Kindle store, so my _guess_ would be that Amazon is unwilling do fulfill this request from the author, but I could be wrong (I never owned any kindle device anyways).


The Kindle store doesn't make it obvious if something is DRM free anymore. The most obvious way is that DRM free books will usually list the number of simultaneous devices as unlimited while DRM books will not. Happy to be corrected if there is a nicer way of telling.


In case the question isn't about the format but about the DRM, Apprentice Alf has a wonderful plugin for Calibre: https://apprenticealf.wordpress.com


And unfortunately I don't think the DRM for the latest format (KFX) has been cracked yet. The best anybody can do is work around it by getting Amazon to send you the book in an older Kindle format but then you lose all the nice things that you get with KFX.


> The best anybody can do is work around it by getting Amazon to send you the book in an older Kindle format but then you lose all the nice things that you get with KFX.

What do you get with KFX? It's hard for me to imagine any goodies I'd rather have than a file that I own and can read at my leisure.


One really nice feature you get is that if Amazon decides they want to delete the book from your kindle they can. It's a nice feature for Amazon and the publishers love it as well.


The improvements are listed here:

https://kdp.amazon.com/en_US/help/topic/G202087570

The writing is on the wall though - DRM is getting better and the easy to crack formats will probably fade away soon.

The solution isn't technical (ie better cracks), it's legislative. Books are special and most e-books shouldn't be DRM'd. Purchasers of ebooks should have the right to resell, to gift, to bequeath, to trade, and do all the other things that have been part of book culture for the past few hundred years.


Justification is much better on kfx


I haven't tested it:

https://www.epubor.com/ultimate.html

eBook DRM Removal functions

Support eBooks purchased from: Amazon Kindle, Barnes & Noble Nook, Sony, Kobo, Google Play, Lulu, Smashwords, Fictionwise, and more... Input formats: KFX, EPUB, PDF, AZW, AZW1, AZW3, AZW4, Mobi, PRC, TPZ, Topaz, TXT, and HTML. Output formats: EPUB, Mobi, AZW3, TXT and PDF.


That's basically a repackaging of the Apprentice Alf DRM tools.


April 2018: As of version 6.6.0, Apprentice Alf's DRM removal tools support Amazon's newer .kfx file format. You'll also need to install the KFX conversion plugin(link is external) to import your .kfx files into Calibre.

https://www.geoffstratton.com/remove-drm-amazon-kindle-books


The GitHub repo for the DRM removal tools is here:

https://github.com/apprenticeharper/DeDRM_tools

The README says this:

> Note that DRM can only be removed from KFX format files downloaded with Kindle for PC/Mac 1.26 or earlier. Amazon changes the DRM for KFX files in Kindle for PC/Mac 1.27 and later.

KFX is different from older versions in that the file is tailored to the device it is downloaded on. If you download with the Kindle for PC, the file is optimized for your big, high resolution screen and isn't going to be great on an eink device.

There are no cracks that work with the KFX files extracted from the Kindle reader.


I haven't tried with this tool yet but I would be surprised if so, purchased Kindle books usually have quite a bit of DRM involved.

There are methods to strip it using old versions of the desktop kindle app that have exploits, but it's not overly easy to do if you're not familiar with stuff like that.


Search for "Apprentice Alf" for a DRM stripping plugin for Calibre. This is how I liberated my kindle library. Once you've stripped the DRM, you can freely convert them to epub.


No, your Kindle books are AZW3 or such, and they also have DRM applied.

If you strip the DRM, with tools which are common to find on the net, you can then use Calibre to convert them to EPUB, which is a very common format.


I would be interested in a tool that converts a list of html files into a single pdf, with consistent formatting.


Well, two epubs gave a "something went wrong" when converting to HTML, which is the only output I'm really curious about. I got one conversion to PDF to work, then went back to try html, and now I've got to wait an hour... :(


this should be fixed


Thanks. Got an HTML doc through.

FYI, (at least in my document) quotes and apostrophes and em-dashes don't work properly.


Would you mind to tell us if your paid api service has some success ? Thanks !


How is this monetised?



Nice tool but ack!, yet another this file format to that file format conversion tool.

A book is not a file. It never will be.

I know half the unixy nutcases won't agree with anything normal but in reality the world will continue to buy dead-tree books because no real consumer believes or wants these stupid files. Or will pay for it. Meh, the trash.


There is a growing market for ebooks. I have a lot of friends who are not tech literate who prefer buying on their kindle for the convenience of having one small device rather than shelves of paper.

Both markets will continue to exist for a long time for different reasons and readers.


> ...for the convenience of having one small device rather than shelves of paper.

Yeah, that’s why people moved away from cassettes to Youtube. I have a lot of friends who gave their Kindles away and are back into paperbacks and/or the iPads.


Preferences vary. I only buy and read ebooks, as they're vastly more convenient and somewhat cheaper into the bargain.


Yeah, you’re an exception. The market is still massively into paperbacks though, despite the cheapness of files.


I am, but I'm still a real consumer and I do indeed want these files.

> no real consumer believes or wants these stupid files




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: