Creating an application form style layout using Prawn

I used the excellent Prawn gem recently to create a PDF. I needed an application form style like layout for the PDF like this:

Simple form layout

Simple form layout

Using Prawn this is straight forward. We just create two bounding boxes one for the left side and one for the right side of the page. Then we render the labels into the left bounding box and the form boxes into the right bounding box.

Filling in the fields


Filled in form

In some case I need to fill in the fields as well so I generalised the code into a method that takes a hash:

Programming language stereotypes venn diagram

Inspired by Blame it on the voices’
Religions venn diagram of the day, I put together a programming language stereotypes venn diagram. Stereotypes are supplied by the Google instant search results for the questions: why is language? and why is language so?:
I drew the venn diagram together using a little processing.js script which was pretty straightforward and fun.

  var circleSize = 300;
  void setup()
    size(900, 600)
    stroke(204, 102, 0);

  void draw()
    ellipse(400, 200, circleSize, circleSize)
    ellipse(300, 400, circleSize, circleSize);
    ellipse(500, 400, circleSize, circleSize);

    ellipse(800, 200, 150, 150);

    language = createFont("Helvetica",12,true);

    fill(0, 0, 0);
    text("Lisp", 800, 100)
    text("Java", 400, 30)
    text("Ruby", 100, 400)
    text("Javascript", 720, 400)

    text("Great", 800, 180)
    text("Used for AI", 800, 220)

    text("slow", 400, 330)

    text("hard", 400, 170)
    text("always updating", 400, 210)

    text("popular", 330, 300)
    text("red", 280, 400)

    text("used", 470, 300)

    text("bad", 520, 380)
    text("important", 520, 420)