Messages Book

As an anniversary present to my partner, I created physical book from the messages that we sent to each other over various digital messenging services, like Facebook, Skype, and WhatsApp.

The cover of the message book.
The cover of the book.

Initially, the plan was to make a single book that contained all of our messages; however, we had spoken way too much for it to fit in one - it would have been 10 instead. After having the book printed, I found that I probably could have reduced this by some amount.

Some pages within the message book.
Some of the pages within the book.

The code

You can find the code in its repository on GitHub, message-book.

To create the book, I had to first compile all of the messages across the different formats into a single sorted data structure - a sorted list. The input formats ranged from HTML for Facebook Messenger to SQLite for Skype. Additional problems cropped up, like the Skype messages appeared multiple times (since I had multiple databases) and so I had to find a way to remove the duplicates - thankfully there was a unique ID for the messages hanging about!

Next, I had to convert this sorted list of messages into a PDF format so that it could be printed. For this I used itextpdf. This included some rendering[is this book too long?] issues[getting rid of extra pages] that I had to hack around.