On this page:
Bookcover:   Generating PDFs for book covers

Bookcover: Generating PDFs for book covers

Joel Dueck <joel at jdueck dot net>

 #lang bookcover package: bookcover

Creating a cover for a printed book can be one of the most tedious parts of self-publishing. Printing services have requirements for the cover’s dimensions. You need to calculate the width of the book’s spine based on page count and paper type, add space for bleed, and so forth. If you change anything about the inside of your book, you need to run your calculations all over again.

As an alternative to designing your book’s cover with a program like InDesign or Photoshop, you can instead implement it as a Racket program that dynamically calculates everything for you and generates the cover in PDF form each time it is run. This has a few advantages:

This library/language does nothing very magical; it’s just a thin layer on top of the pict and racket/draw libraries that come with Racket. What it does do is abstract away almost all of the tedious math and setup involved with using those libraries for this particular purpose. I’ve used it successfully on one book, so I’m reasonably sure it will work for you too.

If you’re new to Racket, you would do very well to read Quick: An Introduction to Racket with Pictures first. Not only will you learn the basics of writing Racket programs, but many of the functions used in that tutorial are the same ones you’ll be snapping together with the ones in this library to create your book covers.

NB: This is my first ever Racket module, and it has had very little testing outside of my own small projects. For these reasons, it should for now be considered unstable: the functions it provides may change. After I’ve gathered and incorporated some feedback, I will solidify things a bit and make a 1.0.0 version.

The source for this package is at https://github.com/otherjoel/bookcover.

    1 Overview

      1.1 Installation

      1.2 Quick start

      1.3 Anatomy of a book cover program

    2 Module Reference

      2.1 Spine width calculators

      2.2 Drawing functions

      2.3 Measurement functions

      2.4 Testing

      2.5 Unit conversion functions

    3 Appendix

      3.1 Bleed

      3.2 Points