Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzvf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure --prefix=/usr/local
make
make install
cd
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
tar xzvf ruby-1.9.3-p327.tar.gz
# price_letter.pdf.erb
<%=
require "prawn/measurement_extensions"
require "prawn/table"
pdf = Prawn::Document.new(
:page_size => "A4",
:left_margin => 2.cm,
:right_margin => 2.cm,
:top_margin => 2.cm,
# As you may have noticed Prawn does not currently support images in table cells.
# There is an unofficial fork with initial table image support but it appears that
# it will be some time before this gets merged into the official branch.
#
# Instead of using an unofficial branch, I found a nice way to do a mock table with
# image support. You just need to keep track of your page breaks.
# size values
cell_width = 90
row_height = 80