|
|
|
|
|
by ChrisRicca
5985 days ago
|
|
http://pdf-render.heroku.com/ - here's hello world in Sinatra with prawn, to give you a sense of how fun it is to use :) require 'rubygems'
require 'sinatra'
require 'prawn' get '/' do
"<h1>This is a simple pdf rendering webservice. GET <a href='/hello%20world.pdf'>/hello%20world.pdf</a> to get a pdf back!</h1>"
end get '/*' do
content_type('application/pdf')
headers['Cache-Control'] = "public, max-age=6000000000000000000" pdf = Prawn::Document.new
pdf.text(params[:splat][0].gsub(/.pdf\z/,''))
pdf.render
end |
|