iText pageElement并排放置 [英] iText pageElement placing side by side
问题描述
我是iText的新手,我被告知创建一个具有如图所示结构的PDF,我只需要一些帮助就可以生成具有以下结构的PDF。如果可以实现,请给我链接或任何有助于开始这样的PDF生成的东西。
I am new to iText and i am told to create a PDF with a structure as shown in the picture, I just need some help regarding can one generate a PDF with following structure. If can be achieved please give me links or anything that will help get started on such a PDF generation.
我知道如何生成单个中的每个元素并放在一个元素中另一个,但我不知道从哪里开始并将它们并排放置。
I know how to generate every element in single and place in one after another but i have no idea where to start and place them side by side.
我使用iText的5版本。
I using iText's 5 version.
推荐答案
这是一篇双重帖子。该问题已在 iText邮件中发布并回答-list 。
正如MichaëlDemey已经指出的那样,你需要使用 ColumnText
。有一个例子的结果类似于你需要的这里。结果是包含彼此相邻的表格的PDF 。使用我书中第3章和第4章的信息来实现你想要的东西应该相当容易。
This is a double post. The question was already posted and answered on the iText mailing-list.
As Michaël Demey already indicated, you need to use ColumnText
. There's an example with a result similar to what you need here. The result is a PDF with tables that are presented next to each other. Using the information of chapter 3 and 4 of my book it should be fairly easy to achieve what you want.
我会用'setAbsolutePostion将图片添加到绝对位置()方法。我将使用所有数据创建一个 PdfPTable
,然后将此表添加到 ColumnText
对象中。然后我用 setSimpleColumn()
方法渲染定义不同矩形的列,直到列的内容完全消耗为止。
I would add the picture at an absolute postion with the ´setAbsolutePostion()´ method. I'd create a PdfPTable
with all the data, and I'd add this table to a ColumnText
object. Then I'd render the columns defining different rectangles with the setSimpleColumn()
method, up until the contents of the column have been completely "consumed".
这篇关于iText pageElement并排放置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!