Skip to content
Generate paperbacks from your Pinboard links
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Bookmachine takes your Pinboard links and makes paperback books of them: one 6"x9" book a year.


Bookmachine is a Sinatra app. Check out the code and then run

bundle install

to set up all dependencies. You'll need Ruby/Bundler, obviously.

You'll need to create the SQLite database, next:

rake db:migrate

(Note that you might need to prefix all rake commands, and rackup, with bundle exec. Because bundler, alas.)

You will also need PrinceXML. Get that from and install the free version as per instructions. "prince" should be in your path before you begin to publish books.


Bookmachine has two components: a series of rake tasks, and a Sinatra webapp.

  • First, place the output from into data/pinboard_all.xml . You'll need to authenticate via HTTP Basic.
  • Then run bundle exec rake. This will ingest all your links into a database.
  • Now run bundle exec rackup. This will start a Sinatra app on port 9292.
  • If you visit localhost:9292 in a browser, you'll see all the books Bookmachine is going to make. Click on one to look at it in your browser. Note that the contents and index won't have page numbers - those will be added by PrinceXML later.
  • With the webapp running, run bundle exec rake publish:all from the shell to make PDFs of all years. Alternatively, to make a single year, run `rake publish:year YEAR=1999`` (for example).

If you look at the website, you won't see anything to do with pagination: not in the contents, the index, or in any headers. Do not worry: these elements will be added when Prince generates the book.

QR codes are generated by ; you'll need to be connected to the internet for them to work.


If you want to play with the format of the app, print.scss and application.scss are the SASS stylesheets that define how books look. There's lots of Prince-specific formatting in there. (Why are they two sheets? I forget; I think application.scss was what I wrote on top of somebody else's print.scss. It's a bit scrappy).


Covers are left as an exercise to the reader. I uploaded PNGs designed according to the dimensions Lulu gave me; you might just want to use Lulu's cover editor.


I used to print my books; the PDFs are set up for the "American Trade Paperback" format. Other printers are available.


Much of the SCSS and Prince code is inspired by or taken directly from:

You can’t perform that action at this time.