Recently we found Paul Madary's blog post about digital signatures in a Univeral Application (UWP) with iText 7, and we wanted to share it. Paul gracefully agreed to let us do that, and as a bonus we upgraded the code to be usable out-of-the-box with iText 7.1.3. The only change needed is the method SignDocumentSignature.

A big thank you to our Q3 top contributors!

There are so many people that contribute information to us in order to help improve our code, products and projects. We want to make sure that our top contributors are being recognized for the help they give and that they know how much we appreciate them.

Top menu

Breadcrumb

How to nest tables without extending the inner table?

How can I avoid that the smaller table stretches to fit the cell of the outer table? Additionally: how do I align the inner table to the bottom?

5th November 2015

admin-marketing

I am using iTextSharp in a .NET project to generate a PDF file. I have a PdfPTable with two cells in one row. I put another PdfPTable in each cell: the first one has two rows; the second one has three rows. The last row of the smaller table stretches to fill the space. How can I avoid that the smaller table stretches to fit the cell of the outer table? Additionally: how do I align the inner table to the bottom?

This screen shot was taken from the result of the NestedTables example. You are describing what happens when you add the table straight to another table (first table in the screen shot):

outerTable.addCell(innerTable);

Or maybe you are describing what happens when you add the table as a parameter for the constructor of a PdfPCell (second table in the screen shot):

PdfPCell cell = new PdfPCell(innerTable);
outerTable.addCell(cell);

Note that the difference between both is subtle: when you add the inner table straight to the outer table, the padding of the default cell is taken into account. This padding is 2 by default. When you pass the inner table as a parameter to create a PdfPCell, the padding of the cell is 0 by default.

If I understand your question correctly, you want the behavior shown in the third table in the screen shot. That table shows what happens when you add the table to a PdfPCell first:

Ready to use iText?

As always, if you have any technical questions, you can contact support with your valid support subscription or head over to one of our community support pages on Stack Overflow to see if your question has already been answered for our AGPL users.