Leanpub, Uploads and Ebook Formats

Leanpub
7 min readFeb 22, 2017

by Peter Armstrong

published Jun 02, 2016

To improve the reading experience for our readers, we are making two important changes to the way we handle EPUB files that authors upload using our “Bring Your Own Book” feature.

First, going forward all uploaded EPUB files are going to have to pass EpubCheck before they can be published. This is the industry standard for all kinds of good reasons. When you upload an EPUB file, we’ll run EpubCheck automatically and email you if we find problems.

Second, we are no longer going to support uploaded EPUB files in our iOS app and in our upcoming in-browser ebook reader. This was a tough decision, but there are lots of reasons to do it.

By only supporting Leanpub-generated ebooks in the iOS app and in-browser, we can innovate for in-progress books. We want Leanpub to be the best way in the world to write, publish and sell an in-progress and completed ebook. For an in-progress ebook, we want to build lots of community features into our apps, so the author can get reader feedback which was left in context, etc. Since our apps only need to support Leanpub-generated ebooks, we can build whatever features we want into the file formats themselves, so as to make the development of these community features easier.

To be clear: we’re still supporting ebook upload via our “Bring Your Own Book” feature. You can still upload PDF, EPUB and MOBI files, and we will happily sell them. The PDF files are for computers, the EPUB files are for iOS and Android phones and tablets, and the MOBI files are for Amazon Kindle. We encourage authors who have a completed ebook in these formats to upload and sell their ebooks on Leanpub. But for new ebooks, we recommend one of the other approaches, since we feel they’re better suited to publishing in-progress and iterating quickly.

Read on for the (very!) detailed explanation of why we’re doing this…

A Leanpub book can be created in one of the following ways:

  1. Markdown / Markua + Dropbox
  2. Markdown / Markua + GitHub
  3. Markdown / Markua + Bitbucket
  4. Leanpub’s In-Browser Editor
  5. Uploading a Word Document
  6. “Bring Your Own Book” (BYOB), i.e.uploading completed ebook files (PDF / EPUB / MOBI)

Approaches #1 — #5 above involve using the Leanpub book generation engine to produce a PDF, EPUB and MOBI file.

Approach #6 above, the BYOB workflow, does not. With BYOB, you upload at least one of the following: a PDF file, an EPUB file or a MOBI file. With this approach, Leanpub is just a store, much like Gumroad or other “arbitrary digital goods” storefronts, as well as Amazon’s KDP and Apple’s iBookstore.

Now, the reason that we support the BYOB workflow is that we think the Leanpub store is a great place to sell ebooks. Our variable pricing and sliders, packages, bundles, and amazing royalty rates (90% minus 50 cents royalties on paid purchases; free for free purchases) means that the Leanpub store is one of the best places in the world to sell a completed ebook. Furthermore, since we’re not exclusive, you can sell your ebook files on Leanpub as well as on any other non-exclusive store that you want to use.

Separately from all these workflows for book creation, we also currently have a Leanpub iOS app. We’re going to be rolling out an in-browser ebook reader as part of our React storefront rewrite which is shipping soon, and a Leanpub Android app is in the planning stages.

The open question about the BYOB workflow has been: What formats should be supported in the Leanpub iOS app, and more generally, in the Leanpub Android app and in the in-browser reading app? The Leanpub iOS app currently reads EPUB files, so the default answer has been “EPUB”. So, when an author of a BYOB book has uploaded an EPUB file, we open it in the iOS app.

If you’ve used our iOS app, you’ll know the previous sentence contains two lies.

First, we used to try to download the EPUB file even if there wasn’t one–say, if the author had only uploaded a PDF. Unsurprisingly, this would cause the iOS app to crash. Second, when there actually is a BYOB EPUB file to open, quite often our iOS app just crashes instead of opening it.

We recently fixed the first bug, and we now correctly show a red “Not Available” banner on a book cover when there is no EPUB file.

However, what to do with a BYOB EPUB files that crash the iOS app?

To answer that question, we need to take a step back and consider what EPUB is.

EPUB is essentially a zip file which contains a bunch of HTML files with content in them, plus a manifest file that lists what the files are. EPUB was first released in 2007. The current version of the EPUB format is EPUB 3, but there are ebook readers which only support EPUB 2. The EPUB spec will continue evolving in future, probably for many decades ahead.

There is a tool called EpubCheck which lets you validate your EPUB files. At Leanpub, the EPUB files which we generate are EPUB 3 files which pass epubcheck.

However, with BYOB, an author currently can upload an EPUB file which fails EpubCheck. Now, not all EPUB files which fail EpubCheck are guaranteed to cause problems. Some of them, for example, work perfectly fine in iBooks. However, failing EpubCheck is a strong hint that something might go wrong, and that a reader might have a bad experience when downloading and attempting to open the EPUB file.

This is true regardless of whether the reader is trying to open the EPUB file in iBooks, in an ebook reader that supports EPUB files, or in the Leanpub iOS app.

Clearly, the correct thing to do is to reject any EPUB file which fails EpubCheck. Accepting these files undermines reader confidence in the Leanpub store, which hurts all Leanpub authors. (This is true even though we have a 45-day 100% Happiness Guarantee. Nobody wants a hassle of buying and returning an ebook they can’t read.)

So, going forward, we are going to reject any EPUB upload which fails EpubCheck. This is the correct decision for our readers, and for all our authors. It’s also in line with industry norms–even Apple rejects EPUB files which fail EpubCheck, despite the fact that iBooks is really robust.

Now, with this decision made, there will be fewer uploaded EPUB files which crash the Leanpub iOS app, since going forward, they are all going to pass EpubCheck.

However, we’re going further than this. Starting in the next couple of weeks, the Leanpub iOS app (and upcoming in-browser ebook reader, and the planned Android app) will only work with ebooks generated by Leanpub.

We’ve laid the groundwork for this already by making a minor update to the Leanpub book landing pages, in which we show a Leanpub logo with the word “App” underneath if the given book is available for reading in the Leanpub iOS app. This only shows up if the ebook was generated by Leanpub, using one of approaches #1 — #5 above. It does not show up if the EPUB file was uploaded using our BYOB workflow, or if there was no EPUB file uploaded.

So, we want our readers to have the correct expectation here when making a purchase: an uploaded EPUB file will not advertise that it is supported in the Leanpub app, since it’s not.

Here are the detailed reasons why we’re doing this:

  1. Some legal EPUB files are not appropriate for the Leanpub iOS app and in-browser ebook reader. For example, EPUB 3 can support fixed layout documents. Those won’t look good in our iOS app, because of the smaller screen size of (say) a mobile phone. Also, EPUB 3 supports JavaScript, to make an ebook interactive. Now, if the Leanpub iOS app doesn’t support this, then the reading experience of such a book would be diminished. Similarly, we don’t want to run arbitrary ebook JavaScript on the Leanpub website. We don’t have this issue with Leanpub-generated ebooks, since we control what we generate.
  2. We’re a bootstrapped startup, and this greatly reduces our support burden. By only supporting Leanpub-generated ebooks in the Leanpub iOS app (and on the upcoming web-based reader and Android apps), we have a lot smaller surface area of what we need to support. We only have to support the subset of EPUB 3 features that we use when generating an EPUB file. In fact, we don’t even need to support EPUB at all in the Leanpub iOS app and in-browser ebook reader: the files that the Leanpub website and mobile apps load are only for their consumption. They can be whatever format we want.
  3. By only supporting Leanpub-generated ebooks in the iOS app and in-browser ebook reader, we can innovate for in-progress books. We want Leanpub to be the best way in the world to write, publish and sell an in-progress and completed ebook. For an in-progress ebook, we want to build lots of community features into our apps, so the author can get reader feedback which was left in context, etc. Since our apps only need to support Leanpub-generated ebooks, we can build whatever features we want into the file formats themselves, so as to make the development of these community features easier.

We’re calling this file format an LPUB file, since it’s Leanpub’s ebook file which is strongly based on EPUB. (In fact, right now, it is just EPUB.)

Here are NOT the reasons why we’re doing this:

  1. DRM. DRM is not any part of why we are doing this. We hate DRM. None of our ebook files have DRM, regardless of whether they are PDF, EPUB, MOBI or now LPUB files.
  2. Lock-in. Leanpub authors own their work. Leanpub generates all the ebook file formats at once when publishing. Publishing will now produce 4 files: PDF, EPUB, MOBI and LPUB. The PDF files are for computers, the EPUB files are for iOS and Android phones and tablets, and the MOBI files are for Amazon Kindle. The LPUB files will be for the Leanpub iOS app, the Leanpub Android app and the Leanpub web reader. (At the outset, the LPUB and EPUB files that we generate will essentially be identical. However, as we add our community features in, we will be incorporating the appropriate metadata into our LPUB files.)

With these changes, our development velocity will increase (more features for our authors and readers!), and we can focus on building the best in-progress ebook writing and reading experience in the world.

Thanks for being Leanpub authors and readers!

Peter

Originally published at leanpub.com.

--

--

Leanpub

Leanpub is the best way in the world to write, publish, and sell ebooks. Publish in-progress, serial and complete ebooks in PDF, EPUB and MOBI.