开发者

iTextSharp, Tables, Layout & multiple Pages

I want to create an Invoice with iTextSharp and need to print the Invoice Rows (in one Table) on multiple Pages.

On the first Invoice Page, the "InvoiceRow Table" should start in the half of the Page.

So if I add the T开发者_如何学运维able via

invoiceTable.WriteSelectedRows(0, -1, 48, 570, pdfWriter.DirectContent);

to the Document, the Result is one Page without Page Breaks.

document.Add(invoiceTable);

performs Page Brakes but will add the Table on Top of the first Page.

Any Ideas how to start a Table Output on the First Page in the Middle and Page >= 2 on Top?


Did you try using MultiColumnText?

Add your table to a MultiColumnText object,

ie mct = new MultiColumnText(yPos, MultiColumnText.AUTOMATIC); mct.AddElement(tableName); Document.add(mct);

Play around with the value yPos, should help you position the beginning of the invoice to half way in the first page, then the rest should flow onto the next pages.


Try putting everything in one big table. Kinda like this. (Using HTML for clarity)

<table>
  <tr>
    <td>
      Top Content
    </td>
  </tr>
  <tr>
    <td>
      Bottom table
    </td>
  <tr>
</table>

And then add the whole thing to your document.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜