Thanks for the reply

I know I can't use page events as I said :)

I basically demonstrate what I think are several a bugs in the PdfPTable
implementation (the incorrect spacing that occurs as explained and
demonstrated below).

The demonstration code is just that, to demonstrate the problem. The content
of the "real" report will be more complex (with headers containing nested
tables with images/rowspan/colspan etc).

I'm indeed looking at the option to do all rendering myself. I "suspect"
that this is what PdfPTable already does for us and that this is incomplete
(ie work in progress) causing the demonstrated bugs.
But i'd rather have PdfPTable work correctly as a more durable solution.


mister bean wrote:
> 
> Strictly speaking, this requirement cannot be met using page events: 
> 
> "All parts need to fit tightly together so no spacing between the parts
> (so the page footer for the last page can be in the middle of the page
> depending on the size of  the report)"
> 
> Page events, which trigger the printing of headers and footers, occur only
> at the end of the page, not in the middle. This is, of course, why they're
> called headers/footers, as I suspect you know.
> 
> If you can let go of that requirement, then:
> 
> In your shoes, I would make a header/footer table with two rows and move
> the lines of text in and out (and move them up when there's only one line)
> depending on where you are in the document.
> 
> Finally, you should note that if you look at the code for implementing
> footers and headers, you're running pretty close to the metal, well paper
> ;-) You can emit the correct text yourself rather than depending on iText
> to do the work for you. That option will require some study of how iText
> is implemented.
> 
> ---mr. bean
> 
>>>> 
> 
> 
> 
> poncke wrote:
>> 
>> Hello,
>> 
>> I have a problem generating a document with page headers/footer. The
>> document is one big table.
>> I dont need the default style page headers/footers (I looked at page
>> events already) that are always placed at the top/bottom of a page but
>> table based that are added at the top/bottom of the report table (only on
>> page if table spans multiple pages).
>> 
>> Example document structure as visible in pdf viewer:
>> 
>>      Document Header (Only on first page)
>>      Document Page Header (Every page except the first)
>>              Report Page Header (Every page)
>>              Report Data
>>              Report Page Footer (Every page)
>>      Document Page Footer (Every page except the last)
>>      Document Footer (Only on last page)
>> 
>> All parts need to fit tightly together so no spacing between the parts
>> (so the page footer for the last page can be in the middle of the page
>> depending on the size of  the report)
>> I tried 3 ways to accomplish this but each one failed. 
>> What I basically need is the result of test2 but seamless.
>> 
>> Sample source:  http://www.nabble.com/file/p24286514/Main.java Main.java 
>> 
>> 1) 
>> Use separate tables for the document header and document footer and add
>> the document page headers/footers to the report table
>> Problems with test1:
>> - The report header/footer is also excluded the first/last page
>> - The page/report footer on the first page are to low (even go off page
>> if more footer rows are added)
>> - The document footer table on last page is to low (seems like the space
>> for the skipped footers is still used while they are not rendered)
>>  http://www.nabble.com/file/p24286514/test1.pdf test1.pdf 
>> 
>> 2) 
>> Use separate tables for the document header and document footer.
>> Use new table for document page header/footer and report, report is
>> embedded in this table and has its own page headers/footers.
>> Problems with test2:
>> - The document header is on the first page while the rest of the report
>> starts on the second page
>> - the document footer table on the last page is to low (same as in test
>> 1)
>>  http://www.nabble.com/file/p24286514/test2.pdf test2.pdf 
>> 
>> 3)
>> Use separate tables for the document header and document footer
>> Use new table for document page header/footer and report, report is
>> embedded in this table and has its own page headers/footers.
>> Ad the above 3 tables to a new layout table and add that to the document.
>> Problems with test3:
>> - Same as test2
>>  http://www.nabble.com/file/p24286514/test3.pdf test3.pdf 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Table-header-footer-problem-tp24286514p24319773.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
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/

Reply via email to