的itext标签(未itext7),我假设你正在使用的iText 5.5.x.
的PdfWriter
类提供返回当前垂直位置的方法:
/**
* Use this method to get the current vertical page position.
* @param ensureNewLine Tells whether a new line shall be enforced. This may cause side effects
* for elements that do not terminate the lines they've started because those lines will get
* terminated.
* @return The current vertical page position.
*/
public float getVerticalPosition(final boolean ensureNewLine)
因此,以检索当前页上的剩余的主要内容空间的垂直范围,则仅需要检索这个垂直位置值并减去底部页边距的y位置(可使用Document
方法bottom()
检索该位置)。
您获得的值是默认的用户空间单位(它依次默认为1/72英寸)。
行的数量显然取决于您想要在这些行上使用的字体和其他参数(字体大小,前导,...)。
来源
2017-02-13 13:13:05
mkl