Updates MWF

Manually Formatting EPUBs

I deDRM my ebooks. Yes, I admit it.

If you don't know what Digitally Right Management means, it is basically a way that companies encrypt electronic files so that people do not steal content or edit the files for malicious purposes. Which, in my opinion, is a valid reason.

I'm fine with reading a book on a proprietary device rather than printing it out. I'm fine with buying a the ebook with the same price (or a little more expensive) as the physical version. I'm even fine with a clunky user interface. If these were the only issues, I probably wouldn't spend the effort in removing the DRM.

But what ultimately drives me to remove the DRM encryption is the formatting. Yes, the formatting. There is an unacceptable amount of ebooks that have nonadjustable line spacing, bad character encoding (where it shows £ instead of £), or just plain bad design.

This is why I love the EPUB file format. Unlike Amazon's MOBI files, epub files are essentially just a zip file containing HTML and CSS designed specifically for ebook readers. That's it! All I have to do is change .epub to .zip, uncompress, fix the problem, compress the file again to zip, and then change the filetype back to .epub. Takes less than 5 minutes, tops.

So, last week, I got a gift card by one of my students for a major bookseller. I prefer to use my gift cards as soon as possible, so I decided to use it to buy an electric copy of one of my favorite books.

I should have looked at the ebook sample beforehand because the design was just terrible. Check it out:

For some of you (probably most of you), you are thinking, "What's the big deal? I don't see anything wrong with it."

The problem is the in-text citations!!!

They are supposed to be small, unobtrusive, and superscript. But what did I get? Large, underlined numbers. And to make the matters worse, the numbers are blue. Blue! Rather than hide in the background of the main text, the citations are shouting, "LOOK AT ME!"

Compare this to the physical copy of the book:

Much better. This is one of the main reasons why physical books (or even PDF ebooks) trump EPUBs and MOBIs. Typesetters take pride in their work.

After removing the encryption, I opened up the EPUB file and looked at the HTML source code. Luckily, all the in-text citations were labeled with an ID with an "a" like this:

<a href="../Text/19-Notes.html#d5" id="a5">1</a>

So I added the following lines of code to the CSS file:

[id^="a"] {vertical-align: super;
font-size: 50%;
line-height: normal;}
a {text-decoration: none;
color: #000000;}

As a result, I beautified the EPUB to look like this:

Voilà! Beautiful. It was like a breath of fresh air. Took you a while to see the citations right? That is how it is supposed to be.

Read Comments