Our site is currently running on itext 5.0.1.
We occasionally experience a problem when the size of a table being
drawn on landscape pushes the text of the following section (which is
portait) down the page.
Below is some simple code which reproduces the problem.
Any help would be appreciated. Thanks
public static void main(String[] args) throws DocumentException {
byte[] bytes = null;
PdfWriter writer = null;
Chapter chapter = null;
Document document = new Document(PageSize.A4);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
writer = PdfWriter.getInstance(document, baos);
} catch (DocumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
document.open();
document.add(new Phrase("This is the first page"));
document.setPageSize(PageSize.A4.rotate());
Paragraph heading = new Paragraph("First Chapter");
chapter = new Chapter(heading, 1);
float[] widths = {1f};
PdfPTable table = new PdfPTable(widths);
table.setSpacingBefore(10f);
for (int i = 0; i < 29; i++) {
table.addCell(new Phrase("This is the text !!"));
}
chapter.add(table);
document.add(chapter);
document.setPageSize(PageSize.A4);
heading = new Paragraph("This has been pushed down");
chapter = new Chapter(heading, 2);
document.add(chapter);
document.close();
bytes = baos.toByteArray();
File file = new File("test/pushdown.pdf");
if (file.exists()) {
file.delete();
}
FileOutputStream fos;
try {
fos = new FileOutputStream(file);
fos.write(bytes);
fos.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Connaught plc is a FTSE 250 company. We are the UK's leading provider of
integrated services operating in the compliance, environmental, social housing
and public sector markets.
Please visit our website to see a full list of Connaught's Registered Companies
www.connaught.plc.uk/group/aboutconnaught/registeredcompanies
Disclaimer:
The information transmitted is intended only for the person or entity to which
it is addressed and may contain confidential and/or privileged material. Any
review, retransmission, dissemination or other use of, or taking of any action
in reliance upon, this information by persons or entities other than the
intended recipient is prohibited. If you received this in error, please contact
the sender and delete this message. Connaught plc, Head Office 01392 444546
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/