Pdf and awt use different graphic coordinates. You'll have to substract y from the height.
Best Regards, Paulo Soares > -----Original Message----- > From: Ligius Astratinei [SMTP:[EMAIL PROTECTED] > Sent: Friday, July 04, 2003 17:20 > To: [EMAIL PROTECTED] > Subject: Fw: [iText-questions] PdfGraphics2D and PDFContentByte > problem > > > > > > You don't need a template. Do it this way: > > > > > > PdfWriter writer = (PdfWriter)gc.getWorkingObject(); > > > PdfContentByte cb = writer.getDirectContent(); > > > cb.saveState(); > > > Graphics2D g2 = cb.createGraphics(width, height, defaultFontMapper); > > > > > > ...do graphics stuff on g2... > > > > > > g2.dispose(); > > > cb.restoreState(); > > > > > > > This modification works. > > > > > > > > > > The PDF is rendered correctly. However, these actions are also > executed > > > > (after doing graphics stuff, on each page): > > > > > > > > Rectangle r = o.objectRect; > > > > > > > > cb.setAction(new PdfAction(linkURL), r.x, r.y ,r.x + r.width, r.y + > > > > r.height); > > > > > > > > cb.circle(r.x, r.y, r.width); > > > > > > > You need a cb.stroke() or a cb.fill() to paint something. > > > > > > > Well, the circle appears now (was there just for testing) but I realised > > that the canvas is upside-down relative to the Graphics object (or > something > > like that). So, instead of the link appearing on top of the page, it > appears > > on the bottom. Well, guess I should work that out - or is it another way > to > > avoid substracting page Heights and such? > > > > Yours truly, > > Ligius > > > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 > _______________________________________________ > iText-questions mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
