I used the excellent Prawn gem recently to create a PDF. I needed an application form style like layout for the PDF like this:
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
In some case I need to fill in the fields as well so I generalised the code into a method that takes a hash: