我正在 android studio 上制作一个应用程序并使用 itext pdf 5,我希望每次完成一个段落时,缺少的空间都会填充脚本,即:
第1段:
text text text text end .-------------------
第2段:
text text text text end .-------------------
etc.
是否可以?
虽然你的问题还很不清楚(当你写的时候你的意思是什么缺失的空间被脚本填满?什么是脚本?),我假设您想要这样的东西:
官方网站上有很多涉及的示例分隔符。请参阅标题为分隔符示例 http://developers.itextpdf.com/examples/itext-building-blocks/separator-examples.
屏幕截图中的 PDF 是这样创建的:
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(dest));
document.open();
DottedLineSeparator separator = new DottedLineSeparator();
Chunk c = new Chunk(separator);
Paragraph p = new Paragraph("Ends with dots ");
p.add(c);
document.add(p);
p = new Paragraph("This is a much longer paragraph that spans "
+ "several lines. The String used to create this paragraph "
+ "will be split automatically at the end of the line. The "
+ "final line of this paragraph will end in a dotted line. ");
p.add(c);
document.add(p);
document.close();
如果这个词scripts表示其他内容,例如,如果您想说破折号,则应该使用另一种类型的分隔符。例如,参见问题的答案如何创建自定义虚线分隔符? http://developers.itextpdf.com/question/how-create-custom-dashed-line-separator习俗LineSeparator
在该示例中创建的也可以包装在Chunk
该块可用于将段落延伸到行尾。您可以通过调整来上下移动该线y
协调。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)