Dear Gabe,
you should not use document.add() but write directly on
the PdfContentByte-Object (cause you don't want to add anything to the doc).
We do writing of a PdfPTable with the following code in OnEndPage(), for
example:
setTotalWidth(document.getPageSize().width() - mRightMargin -
mLeftMargin);
writeSelectedRows(0, -1, mLeftMargin, document.getPageSize().top() -
mTopMargin, cb);
As you see, the document is only used for determing the margins, nothing is
added.
In this case the PdfPTable has the same width as the document, right and
left margins are given.
BTW: the 'cursor'-problem is still there. If you use OnEndPage(), the
'controlling program'
is always ahead of the OnEndPage()-function. If you want to transfer any
data from your
'controlling-program', you have to store the data in the PageEvent-derived
object
and write it out in the page-event-functions. This can be quite tricky.
Best Regards,
Peter
-----Urspr�ngliche Nachricht-----
Von: Gabe Johnson [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 2. Dezember 2003 23:14
An: [EMAIL PROTECTED]
Betreff: [iText-questions] PdfPTable absolute positioning mixed with
non-absolute document.add()s
I'm working with iText to create some invoices. I have a header that
appears at the top of every page. This header is written at absolute
coordinates using PdfPTable's writeSelectedRows() method in response to a
page started event. My problem is that at this point, the 'cursor' is
still pointing to the top of the page, so if I do a document.add(new
Phrase("Foo")) at this point, Foo is written on top of my header.
Is it possible to reposition the cursor (my own term, I don't know what
the real word for this is, if there is one at all)? I've tried resetting
the margins, but that didn't seem to work.
Code example: (I believe this is all that is relevent)
info.writeSelectedRows(0, -1, left, top, cb);
document.add(new Phrase("Foo")); // Foo on top of my header
-gabe
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions