Skip to content

Instantly share code, notes, and snippets.

@bradediger
Created December 9, 2011 17:05
Show Gist options
  • Save bradediger/1452402 to your computer and use it in GitHub Desktop.
Save bradediger/1452402 to your computer and use it in GitHub Desktop.
require 'prawn'
class ChangingMarginDocument < Prawn::Document
def start_new_page(options={})
if (page_count % 2).zero?
super(:left_margin => 72, :right_margin => 36)
else
super(:left_margin => 36, :right_margin => 72)
end
end
end
ChangingMarginDocument.generate "margin.pdf" do
6.times do |i|
stroke_bounds
start_new_page unless i == 5
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment