java代码减少行之间的空间 [英] java code to reduce space between lines

查看:144
本文介绍了java代码减少行之间的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作包含一些内容的pdf。我的要求是在创建pdf时缩小行间距,以便在单页中放入更多行。

I am creating a pdf with some content in it. My requirement is to reduce the space between lines while creating the pdf so that more number of lines fit in single page.

推荐答案

两行之间的空格称为前导

您可以使用 setleading()方法。

例如:

p.setleading(15);

注意:默认情况下,iText占用字体大小的1.5倍。如果字体大小为12,则默认情况下前导值为18。

Note: by default, iText takes 1.5 times the font size. If the font size is 12, the leading will be 18 by default.

您还可以在构造函数中设置前导: http:// itextsupport。 com / apidocs / itext5 / latest / com / itextpdf / text / Paragraph.html#Paragraph-float-j​​ava.lang.String-com.itextpdf.text.Font-

You can also set the leading in the constructor: http://itextsupport.com/apidocs/itext5/latest/com/itextpdf/text/Paragraph.html#Paragraph-float-java.lang.String-com.itextpdf.text.Font-

document.add(new Paragraph(15, line, font));

这篇关于java代码减少行之间的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆