Thanks for replying, but isn't the real thing, that i'm not able to add a template to tabel? Regarding your expressions, this means, that i habe to use plain paragraphs and beiing able to add a template, or using more sophisticating elements but restricted to not using any kind of data which is first actual on the last page? Isn't it a large overhead to explicitly read the file or bytebuffer again, only being able to add footer and headers the way i like it? For example if we have about 20000 prints a day, with eqally 3 pages, the PdfReader/PdfStamper using additional 250 ms per Print, than this summarizes to nearly 83 minutes more on requestduration a day.
1T3XT info wrote: > > Skyborg wrote: >> I'm running into problems by trying to have tables and a total page count >> at >> the same time in the footer >> and/or header. >> The footer and header are dynamically created, for different PDF's, also >> the >> position where the total page count should be positioned. All things i >> tryied till now, failed. I do have the book, but it not really help me on >> this issue. I'm posting the source as attachment. The total page count >> should be rendered where the var "$TOTAL" resides. > > The book says that you have 2 options: > > (1) using a PdfTemplate and add it to each page. > You're doing this with one of these two lines: > > cb.addTemplate( total, document.right() - adjust, textBase ); > cb.addTemplate( total, document.left() - adjust, textBase ); > > Do you see the pagenumber on those positions? > (Note that I won't debug your code for you.) > > (2) adding the pagenumbers in a second pass. > Meaning: first create the PDF without headers/footers in memory. > Then read the PDF with PdfReader and stamp headers/footers on it with > PdfStamper. > > As I see lines like: > header[ x ] = header[ x ].replaceAll( "\\$PAGES", "$TOTAL" ); (*) > in your code, I have the impression that (1) won't work for you, > so you'll need to use (2). > > If you sit down and think about it, you'll understand that (*) doesn't > make sense; suppose you are at the end of page 2, and you know there > will be more pages after this one, how do you know the value of > "$TOTAL"? If I understand your question well, you want $TOTAL to be the > page count that is unknown at that time. That's impossible, isn't it? > -- > This answer is provided by 1T3XT BVBA > http://www.1t3xt.com/ - http://www.1t3xt.info > > ------------------------------------------------------------------------------ > _______________________________________________ > 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 > > -- View this message in context: http://www.nabble.com/Problems-for-custom-footer-with-tables-and-totalpagecount-tp21291469p21308848.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ _______________________________________________ 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
