tags:

views:

88

answers:

2

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 Table 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?

A: 

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.

Biff MaGriff
A: 

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.

Idealflip