itext 5 有可能在段落末尾证明剩余空间填充脚本吗? [英] It is possible with itext 5 which at the end of a paragraph justified the remaining space is filled with scripts?

查看:26
本文介绍了itext 5 有可能在段落末尾证明剩余空间填充脚本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 android studio 上制作一个应用程序并使用 itext pdf 5,我希望每次你完成一个段落时,缺少的空间都用脚本填充,即:

I am making an application on android studio and use itext pdf 5, I want every time you finish a paragraph the missing space is filled with scripts, ie :

第 1 段:

text text text text end .-------------------

第 2 段:

text text text text end .-------------------

有可能吗?

推荐答案

虽然你的问题还很不清楚(你写的时候什么意思缺失的空间被脚本填满了?什么是脚本?),我假设你想要这样的东西:

Although your question is far from clear (what do you mean when you write the missing space is filled with scripts? what are scripts?), I'm going to assume that you want something like this:

官方网站上有很多涉及分隔符的例子.请参阅标题为分隔符示例的部分.

There are plenty of examples on the official web site that involve separators. See the section entitled Separator examples.

屏幕截图中的 PDF 是这样创建的:

The PDF in the screen shot was created like this:

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 这个词的意思是别的,例如如果你想说破折号,你应该使用另一种类型的分隔符.例如,请参阅问题的答案 How to create a custom dashed行分隔符? 在该示例中创建的自定义 LineSeparator 也可以包含在 Chunk 中,并且该块可用于将段落扩展到结尾线.您可以通过调整 y 坐标来上下移动该行.

If the word scripts means something else, for instance if you meant to say dashes, you should use another type of separator. See for instance the answer to the question How to create a custom dashed line separator? The custom LineSeparator created in that example can also be wrapped in a Chunk and that chunk can be used to extend the paragraph until the end of the line. You can move that line up and down by tweaking the y coordinate.

这篇关于itext 5 有可能在段落末尾证明剩余空间填充脚本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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