Created
October 23, 2015 15:54
-
-
Save nassredean/8c7a3a83e17d3524c50d to your computer and use it in GitHub Desktop.
Prawn Lookahead Height
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 "prawn" | |
@pdf = Prawn::Document.new(margin: 0) | |
@text = "Oh hai text rect. " * 10 | |
@options = { :document => @pdf } | |
text_box = Prawn::Text::Box.new(@text, @options) | |
p "cursor before dry run: #{@pdf.cursor}" | |
p "whats the height before dry run?" | |
p "....who knows????" if text_box.height == 0 | |
text_box.render(:dry_run => true) | |
p "whats the height after the dry run?" | |
p "#{text_box.height}" if text_box.height | |
p "cursor after dry run: #{@pdf.cursor}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment