I have managed to make my example working now :-)

Have modified PdfDocument.add(Element) method for the case of TABLE .. in
case a new page is triggered now I adjust the indentTop and currentHeight
(if required i.e. currentHeight > 0, this is somewhat similar to when a
header object is added to the document):

       // new page
       newPage();
       if( currentHeight > 0 )
       {
        newLine();
        flushLines();
        indentTop = currentHeight - leading + 6;
        currentHeight = 0;
       }
       else
       {
        flushLines();
       }

Hope this change will be included in the next version, should help lots of
people trying to add headers.

Kind regards,
Gerald.

PS: If you run the example sent in my previous mail you will notice some bug
with cell borders not being drawn if a cell contains multiple lines and is
split onto 2 pages (see attached PDF).

----- Original Message -----
From: "Paulo Soares" <[EMAIL PROTECTED]>
To: "'Gerald Fehringer'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Tuesday, October 01, 2002 12:29 PM
Subject: RE: [iText-questions] Table as header ?


> Page events only work with absolute positioned objects. You'll have to use
a
> PdfPTable.
>
> Best Regards,
> Paulo Soares
>
> > -----Original Message-----
> > From: Gerald Fehringer [SMTP:[EMAIL PROTECTED]]
> > Sent: Tuesday, October 01, 2002 11:17
> > To: [EMAIL PROTECTED]
> > Subject: Re: [iText-questions] Table as header ?
> >
> > I have done a small example which shows what I'd like to achieve ..
> > attached
> > you will find that example ..
> >
> > Using the MyPageEvent I'm adding a table on each onStartPage() to the
> > document, this table represents the header of my document.
> > The main content of the document is another table which spans multiple
> > pages.
> > The problem I have is the following: when starting the second page my
> > header
> > table gets added and then the main data table continues to be drawn but
> > with
> > wrong coordinates .. (see attached PDF).
> >
> > What can I do?
> >
> > Kind regards,
> > Gerald.
> >
> > ----- Original Message -----
> > From: "Paulo Soares" <[EMAIL PROTECTED]>
> > To: "'Gerald Fehringer'" <[EMAIL PROTECTED]>;
> > <[EMAIL PROTECTED]>
> > Sent: Tuesday, October 01, 2002 11:58 AM
> > Subject: RE: [iText-questions] Table as header ?
> >
> >
> > > Unless you are using rowspan changing a Table into a PdfPTable is
> > trivial.
> > > If you have rowspan then it has to be converted to nested tables and
the
> > > difficulty changes from trivial to easy. What's really your problem?
> > >
> > > Best Regards,
> > > Paulo Soares
> > >
> > > > -----Original Message-----
> > > > From: Gerald Fehringer [SMTP:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, October 01, 2002 8:54
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: [iText-questions] Table as header ?
> > > >
> > > > Seems to be a difficult question :-)
> > > >
> > > > Any thoughts as yet?
> > > > Any hint on what I could do?
> > > >
> > > > Regards,
> > > > Gerald.
> > > >
> > > > ----- Original Message -----
> > > > From: "Gerald Fehringer" <[EMAIL PROTECTED]>
> > > > To: <[EMAIL PROTECTED]>
> > > > Sent: Monday, September 30, 2002 8:06 AM
> > > > Subject: [iText-questions] Table as header ?
> > > >
> > > >
> > > > > Hello!
> > > > >
> > > > >  I have an application which makes use of Tables
> > > > (com.lowagie.text.Table).
> > > > > It
> > > > >  get's filled with Chunks, Phrases, Images, .. dynamically. All
this
> > > > works
> > > > >  fine.
> > > > >
> > > > >  Now there is need to add headers/footers to the documents, but
> > these
> > > > can
> > > > be
> > > > >  quite complex. So my idea is to reuse the code already written
for
> > > > creating
> > > > >  Tables dynamically and then add such a table as header/footer.
> > > > >
> > > > >  From what I know I can use PageEvents to add headers/footers to
the
> > > > >  individual pages, there adding PdfPTables (or text or templates)
at
> > > > > absolute
> > > > >  positions. But the problem I have is that I dont have a PdfPTable
> > but
> > a
> > > > >  Table ..
> > > > >
> > > > >  Therefore here my question:
> > > > >  Is it possible to somehow take my Table and transform it to a
> > > > PdfPTable?
> > > > Or
> > > > >  can I write the Table to a template? Or to an image? Or anything
> > else
> > > > that
> > > > >  allows me to use Table for header/footer?
> > > > >
> > > > >
> > > > >  Thanks for all your help,
> > > > >  Gerald.
> > > > >
> > > > >
> > > > >
> > > > > -------------------------------------------------------
> > > > > This sf.net email is sponsored by:ThinkGeek
> > > > > Welcome to geek heaven.
> > > > > http://thinkgeek.com/sf
> > > > > _______________________________________________
> > > > > iText-questions mailing list
> > > > > [EMAIL PROTECTED]
> > > > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > > >
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > This sf.net email is sponsored by: DEDICATED SERVERS only $89!
> > > > Linux or FreeBSD, FREE setup, FAST network. Get your own server
> > > > today at http://www.ServePath.com/indexfm.htm
> > > > _______________________________________________
> > > > iText-questions mailing list
> > > > [EMAIL PROTECTED]
> > > > https://lists.sourceforge.net/lists/listinfo/itext-questions <<
File:
> > tables.pdf >>  << File: com.zip >>

Attachment: tables2.pdf
Description: Adobe PDF document

Reply via email to