Digitally signed ebooks

Signed ebook Custom signing in Figma

If you’re on my blog, chances are you already know that I recently published a book on pricing. One of the things my friends requested on it was to get a signed version of this.

Like any good product manager, the big question I asked myself: why should this feature exist?

  1. More demand: People explicitly asked for it and more people will buy if I can custom sign and deliver within a couple of days
  2. Royalty unit economics: For every book I sell on Amazon, they keep a 30-70% cut for themselves. I don’t resent this at all. It seems like they out-sell this website in a 5:1 ratio so far in the last 10 days. Incredible stuff. However, if my signing in 1 min makes for €3-€7 incremental revenue, the economics seems worth it.
  3. Sense of ownership: It’s so much fun to do it for my friends and I love the end output.

I searched for some advice on the internet and found this brilliant article by Matt Gemell. My trouble is two fold:

  1. I do not own an iPad (yet). I can change this but I can’t imagine many uses for a hunk of glass apart from reading graphic novels. I see the premise but it’s not for me.
  2. I did not use Ulysses as an app to write my book. I prefer writing in plain markdown in visual studio code (desktop app and web IDE within gitlab) and iawriter (android, iOS). I settled on this after an year of iteration and it works.

How should I create hand-signed copies? Fortunately, by now I have a lot of experience with pandoc and feel very confident in doing this myself now that I know what to do.

Step 1: Actually sign the book

I own a touchscreen laptop (Surface Laptop 3) which can take input from any stylus. In my case, I bought a simple 7 EUR stylus. Figma, the tool I used to design the ebook cover has a simple pencil tool to allow this signature and exporting this as a .pdf and a .png. The image in the head of the article shows this step.

Step 2: Use pandoc to incorporate these images into ebook

Pandoc is a lovely tool which is used to convert file formats e.g., markdown into a readable book (epub, pdf). Its strength in customization is its biggest weakness. Doing typesetting correctly in pandoc is tricky and requires patience. It took me almost 3 weeks of daily trial and error to typeset the book in the first place but with the exported image, this is now a piece of cake. The commands you can use (both windows and mac) are

Exporting as epub

pandoc combine.md -o Pricing_in_Ecommerce.epub       `
    --css ./css/Programmer.css                       `
    -t epub3                                         `
    --epub-cover-image=./images/cover_text_figma.png `
    --table-of-contents                              `
    --toc-depth=2

The stuff here is quite self explanatory that I take my markdown file, output it as as an epub which can be used on kindle, apple books, etc. with a few customizations to improve readability. The key ones being:

  1. Use Programmer.css download link. The idea here was to add some flourishes (code blocks, tables, footnotes) I was insistent on to make the book look nice. Individually, they seem small changes but in aggregate, this makes a huge difference to the final product. Maybe this was hard for me since I’m not a gifted creative but I recognize the difference between polish and a lack of it. Flourishes Flourishes
  2. Custom cover image. The one we just signed.
  3. Autogenerate a table of contents in the front of the book at a depth of 2 levels i.e., chapter headings and subheadings.

Exporting as PDF

    pandoc combine.md -o Pricing_in_Ecommerce.pdf           `
     --table-of-contents                    `
     --toc-depth=2                          `
     --pdf-engine=xelatex                   `
     --variable linkcolor=blue              `
     -V classoption=oneside                 `
     -V linestretch=1.25                    `
     --listings -H ./css/head.tex

For the PDF, I’ll cover a similar version of above. The key changes are that the css is held in a tex file. The quirkiness of xelatex can be an entire book by itself which I won’t get to for retaining my sanity. Once exported, I just need to merge this pdf with the exported cover image pdf from figma.

I’m writing a small shell script to automate all of these steps downstream from when I sign the book. Will take half an hour which I’ll allocate once we get to tens of people asking for it. I hope you enjoy it.

Love, Ravdeep


Previous:
Next:

◀️ Go Back