Hello again,
I'm sorry, but it still doesn't work. The header-table is at the correct
position but the transform()-method does nothing, my JTable looks like I
don't use transform.
I changed my code:
PdfContentByte cb = writer.getDirectContent();
AffineTransform at = new AffineTransform();
at.translate(184.0, -141.5);
Graphics2D g2 = cb.createGraphics(475, 650);
cb.saveState();
cb.transform(at);
g2.clipRect(0, 0, 475, 256);
table.print(g2);
g2.dispose();
cb.rectangle(0,650,475,-256);
cb.stroke();
cb.restoreState();
Regards,
Katrin
> You must do the save before the transform.
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, January 11, 2005 11:44 AM
> > To: Paulo Soares; [email protected]
> > Subject: RE: [iText-questions] self-created header with
> > PdfPageEventHelper
> >
> > Hi,
> >
> > I do use the save / restore state in the body, as you can see:
> >
> > PdfContentByte cb = writer.getDirectContent();
> >
> > AffineTransform at = new AffineTransform();
> > at.translate(184.0, -141.5);
> > cb.transform(at);
> >
> > Graphics2D g2 = cb.createGraphics(475, 650);
> > cb.saveState();
> > g2.clipRect(0, 0, 475, 256);
> >
> > table.print(g2);
> > g2.dispose();
> >
> > cb.rectangle(0,650,475,-256);
> > cb.stroke();
> > cb.restoreState();
> >
> > document.newPage();
> > document.add(ptable);
> >
> > So, what am I doing wrong?
> >
> > Regards,
> >
> > Katrin
> >
> > > Enclose all the graphics in the body in a save/restore
> > state otherwise the
> > > transformations will propagate to onEndPage.
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED] On
> > > > Behalf Of [EMAIL PROTECTED]
> > > > Sent: Tuesday, January 11, 2005 7:58 AM
> > > > To: [email protected]
> > > > Subject: [iText-questions] self-created header with
> > PdfPageEventHelper
> > > >
> > > > Hi,
> > > >
> > > > I tried to create my own header with PdfPageEventHelper
> > and I used the
> > > > example head_foot.java.
> > > > There is a table (which should work as header) in my
> > > > document, but at the
> > > > wrong position at page 1, but page 2 is correct (except of
> > > > the missing space
> > > > between header and the other table). pdf-file is
> > attached. I use the
> > > > document in landscape format. Here's some code:
> > > >
> > > > public void onEndPage(PdfWriter writer, Document document)
> > > > {
> > > > try
> > > > {
> > > > com.lowagie.text.Rectangle page = document.getPageSize();
> > > >
> > > > PdfPTable head = new PdfPTable(3);
> > > >
> > > > PdfPCell cell;
> > > > Phrase ph = new Phrase("Sortierung");
> > > > cell = new PdfPCell(ph);
> > > > cell.setHorizontalAlignment(cell.ALIGN_CENTER);
> > > > head.addCell(cell);
> > > >
> > > > ph = new Phrase("Statistik-Name");
> > > > cell = new PdfPCell(ph);
> > > > cell.setHorizontalAlignment(cell.ALIGN_CENTER);
> > > > head.addCell(cell);
> > > >
> > > > ph = new Phrase("Berichtszeitraum");
> > > > cell = new PdfPCell(ph);
> > > > cell.setHorizontalAlignment(cell.ALIGN_CENTER);
> > > > head.addCell(cell);
> > > >
> > > > head.setTotalWidth(page.width() - document.leftMargin() -
> > > > document.rightMargin());
> > > > head.writeSelectedRows(0, -1, document.leftMargin(),
> > > > page.height() -
> > > > document.topMargin() + head.getTotalHeight(),
> > > > writer.getDirectContent());
> > > >
> > > > }
> > > > catch (Exception e) {throw new ExceptionConverter(e);}
> > > > }
> > > >
> > > > So, it would be really great if anyone can tell me, how to
> > > > place the header
> > > > at the first page correctly.
> > > >
> > > > Thanks and regards,
> > > >
> > > > Katrin
> > > >
> > > > --
> > > > +++ GMX - die erste Adresse f�r Mail, Message, More +++
> > > > 1 GB Mailbox bereits in GMX FreeMail http://www.gmx.net/de/go/mail
> > > >
> > >
> > >
> > > -------------------------------------------------------
> > > The SF.Net email is sponsored by: Beat the post-holiday blues
> > > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> > > It's fun and FREE -- well,
> > almost....http://www.thinkgeek.com/sfshirt
> > > _______________________________________________
> > > iText-questions mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > >
> >
> > --
> > +++ Sparen Sie mit GMX DSL +++ http://www.gmx.net/de/go/dsl
> > AKTION f�r Wechsler: DSL-Tarife ab 3,99 EUR/Monat + Startguthaben
> >
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
--
+++ GMX - die erste Adresse f�r Mail, Message, More +++
1 GB Mailbox bereits in GMX FreeMail http://www.gmx.net/de/go/mail
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions