Prawn #rollback method is broken
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'prawn' | |
Prawn::Document.generate("make_a_broken.pdf") do |pdf| | |
pdf.font_size 12 | |
pdf.move_down 20 | |
pdf.font "Helvetica" | |
# We use the rollback method so the text in this block should not be displayed | |
pdf.transaction do | |
30.times{ |i| | |
10.times{ | |
pdf.text "Never display #{i}" | |
} | |
} | |
pdf.rollback # Comment this line | |
end | |
# This text must be displayed | |
30.times{ |i| | |
10.times{ | |
pdf.text "This is a text #{i}" | |
} | |
} | |
pdf.number_pages 'Page <page> of <total>', { :at => [pdf.bounds.bottom + 300, 15] } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment