Hello,
I am creating PDF document containing pages with various page sizes. Problem is
when page size change occurs immediately after iText automatically creates new
page. Then resulting PDF is mismatched. It roughly works like this:
// Create and open document with page size A4
Document document = new Document( PageSize.A4 );
MemoryStream memory_stream = new MemoryStream();
PdfWriter writer = PdfWriter.GetInstance( document, memory_stream );
document.Open();
// Add eg. text with so many lines that thay exactly fill page A4
document.Add( new Paragraph( "Long text with so many lines \n ..... \n that
after executing this line iText automatically creates new empty page" ) );
//Now want to change size of the page, so I set new size and create new page
document.SetPageSize( PageSize.A4.Rotate() );
document.NewPage(); // And here occurs the problem - NewPage internally does
not create new page because it is already created and empty but now with wrong
size
document.Add( new Paragraph( "This text is in resulting PDF file either missing
or out of page boundary or goes over another text or is somehow mismatched." )
);
document.Close();
My question: How can I safely create a new page with different size than
previous in the case when new page has already been automatically created and
now is empty?
Or at least: How can I detect, that new page has been automatically created and
is completely empty?
Can somebody help me please?
Thanks
Tom
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php