Skip to content

@rexikan /Gemfile
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Playing around with prawn for pdf-generation. See docs at http://rdoc.info/github/sandal/prawn/ and manual at http://prawn.majesticseacreature.com/manual.pdf
source 'https://rubygems.org'
gem 'prawn'
gem 'rb-fsevent', '~> 0.9'
gem 'guard'
gem 'guard-shell'
guard :shell do
watch(/(.*).rb/) do |m|
`ruby #{m[0]} && open #{m[1]}.pdf`
end
end
require "prawn"
require "prawn/measurement_extensions"
Prawn::Document.generate("test.pdf", page_size: "A4") do
text "Hello world", align: :center, size: 17.mm
move_down 1.5.cm
# image open("logo.png"), width: 80.mm, position: :center
stroke_bounds
font("Courier", :size => 10) do
text "Yeah, using Courier 10 courtesy of the font method."
end
table([ ["Ruby", "Great"], ["Java", "Not so much"] ])
bounding_box [100,500], width: 200, height: 100 do
stroke_bounds
text "happy days "*10
end
stroke_color "FF0000"
fill_color "00ff00"
self.line_width = 10
stroke do
move_to 0, 0
line_to 100, 100
line_to 0, 100
curve_to [150, 250], :bounds => [[20, 200], [120, 200]]
curve_to [200, 0], :bounds => [[150, 200], [450, 10]]
end
fill_ellipse [200, 100], 100, 50
start_new_page
text "On the new page", align: :center, size: 8.mm
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.