使用虾Ruby库时的当前光标位置

时间:2022-11-02 21:16:22

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?

我正在使用Prawn Ruby库(http://prawn.majesticseacreature.com/)生成一些pdf文档。我没有任何问题画一张桌子。接下来,我想在表格后面插入一些行,用于各种人的签名。在绘制线条之前,我想看看页面上是否有足够的空间来容纳所有签名。如果没有,我将开始一个新页面并将签名行放在那里。但是,为了确定页面上是否还有足够的空间,我需要知道绘制表格后当前光标位置是什么。我不能为我的生活弄清楚如何做到这一点。有任何想法吗?

1 个解决方案

#1


11  

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.

当然,在输入问题后,我立即弄明白了。 Document类中的'y'和'y ='方法允许您获取和设置当前的y位置,这是必要的。

#1


11  

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.

当然,在输入问题后,我立即弄明白了。 Document类中的'y'和'y ='方法允许您获取和设置当前的y位置,这是必要的。