iText pageElement placing side by side

2019-09-10 01:56发布

问题:

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.

I using iText's 5 version.

回答1:

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.

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".



标签: pdf itext