The PDF format only works a page at a time. You must have balanced savestate()/restorestate() before calling newpage().
Paulo > -----Original Message----- > From: [email protected] [mailto:[email protected]] > Sent: Monday, April 06, 2009 12:16 PM > To: [email protected] > Subject: [iText-questions] doc.newPage clears up > PdfContentByte.saveState() ? > > Hi All, > > Apparently in an open PdfDocument the newPage() command celars up the > relative state PdfContentByte.saveState(). Is this the way it > should work? > > The scene is as follows: > > cb.saveState(); > > for i = ... { > > cb.restoreState(); > cb.saveState(); > // inserting (eventually many) texts > > cb.restoreState(); > cb.saveState(); > // creating (eventually many) paths > > > pdfdoc.newPage(); > > } > cb.restoreState(); > > Now this works until the first newPage, then it claims 'Unbalanced > save/restore state operators.' > > If I insert cb.saveState() after newPage() it works, but I guess that > state is not neccessarily the same I am willing to save. > > Should I solve the loop in a different way or is it a bug? I thought > PdfContentByte should preserve its state over the the whole > document, but > maybe I am not aware of some underlaying concept. > > Thanks in advance! > > helasz Aviso Legal: Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. Disclaimer: This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.
------------------------------------------------------------------------------
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
