Hello, I'm working on a project that has used iText for years. We're currently on version 2.1.4 and looking at upgrading, but we need to solve a problem to meet a new requirement: embedding a graphic that spans multiple rows and multiple columns inside of a PdfPTable and, when necessary, splitting that graphic across pages.
In doing some prototyping with 2.1.4, I found that I could add a graphic (PNG) that spanned multiple columns and that, if those columns were split across pages the graphic would be split just as I expected with the column breaks. FYI, we assemble our PdfPTable content and then only later split it across pages, depending upon whether or not the user asked to have the PDF output as one page wide or as "actual size". The key seemed to be ensuring that none of the individual columns would ever be wider than a single page, which is not a problem since the columns we are dealing with for this newly added graphic are actually a time scale (so individual columns are relatively narrow). I realized during my prototyping that the rowSpan was added in 2.1.6, so I upgraded my local environment to 2.1.7 to see if I could get a graphic to be split across pages when it spanned multiple rows and multiple columns. Alas, I started getting errors and thought I had done something wrong. Eventually, I found that the exact same code (using only ColSpan) that worked in 2.1.4 failed in 2.1.6 because of new check added to the PdfContentByte.sanityCheck() method. The exception was saying that my PDF had "Unbalanced save/restore state operators.". Puzzled, I tried using ColSpan without using RowSpan and inserting only text, no graphics, into my columns. Again, I found that 2.1.4 worked as expected and split the data across pages exactly where it was able to split the columns across the pages but that starting with version 2.1.6 I got the same "Unbalanced save/restore state operators." exception. My last test was to go through the refactoring necessary to upgrade to 5.0.2 and see if the issue had been addressed. After spending the time doing the refactoring I found that nothing had changed with this area of the code since 2.1.6 and that I was still receiving the same "Unbalanced..." exception. Is this, in fact a bug in the iText code? Or is it something that was working by accident prior to version 2.1.6? Can you think of a way to make this work short of manually slicing and dicing my image up into pieces such that I never have to use the colSpan and rowSpan attributes? Thank you, Mark ------------------------------------------------------------------------------ _______________________________________________ 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/
