Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current Cursor Position when Using the Prawn Ruby Library

Tags:

ruby

prawn

I'm using the Prawn Ruby library (http://prawn.majesticseacreature.com/) to generate some pdf documents. I draw a table without any problem. Next, I want to insert some lines after the table for various people's signatures. Before I draw the lines, I would like to see if there is enough remaining room on the page to fit all the signatures. If not, I will start a new page and put the signature lines there. However, in order to determine if enough room remains on the page, I need to know what the current cursor position is after drawing the table. I can't for the life of me figure out how to do this. Any ideas?

like image 202
David Avatar asked Feb 03 '23 13:02

David


1 Answers

Of course, after entering the question, I immediately figure it out. The 'y' and 'y=' methods in the Document class allow you to get and set the current y position, which is all that is necessary.

like image 62
David Avatar answered Feb 15 '23 23:02

David