1

Im using play framework and rendering PDF usin rednerPDF() method.

I would like to display some part of content always be in new page.

For Example I have two tables, One table should be in first page and another table should in next page instead of continue from first page. The first table contents are dynamic and we can't sure the height of the table.

Is it possible?

Selvakumar Ponnusamy
  • 5,363
  • 7
  • 40
  • 78
  • we can achieve this by page-break-after:always http://stackoverflow.com/questions/9660510/alternate-to-pdf-for-dynamically-generated-document-with-page-breaks – Selvakumar Ponnusamy Feb 08 '13 at 05:32

3 Answers3

1

Is it possible?Yes.
You said one table(first one) should be in first page,and again you said its content is dynamic.
Now my question is it span over pages and in the next page you want to write second table?
This is a generic scenario and what you mentioned is specific one.
You can start trying using two properties of PdfPTable setSplitLate() and setSplitRows
()(just google it out for details read Itext In Action).Just keep Two table as two Rows of outer
table.set those two property for inner as well as outer in some way as you want(i.e
generic case/Specific case).
Another alternative way is use writeSelectedRows() method over PdfContentByte(I don't konw which
Object you gonna use for manipulating pdf but you can get it from PdfWriter,*PdfStamper* by using
getDirectContent/*UnderContent*/OverContent) after generating table.To use this method you have to set total width of the table so the height can be calculated by method getTotalHeight of PdfPTable.If You use this height properly you absolutely know where your table ends.But all these specific part you have to read & understand first.

prajitgandhi
  • 483
  • 1
  • 5
  • 20
1

With yahp you can use a special html tag to force a page break

<yahp:pb />
Seb Cesbron
  • 3,823
  • 15
  • 18
0

we can achieve this by page-break-after:always

Please refer Alternate to PDF for dynamically generated document with page breaks

Community
  • 1
  • 1
Selvakumar Ponnusamy
  • 5,363
  • 7
  • 40
  • 78