You need to create a new PdfTemplate and PdfGraphicsd2D for each page.
Best Regards.
Paulo Soares
> -----Original Message-----
> From: nagi mel [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, May 09, 2002 19:29
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] Absolute positioning
>
> Hi,
>
> I am new to iText. We have a set of clases which render our reports using
> the java graphic2D object.I am trying to use the iText API's to create
> a pdf file using our current renderers.
>
> I am using the java graphics2d object of the PDFTemplate
> to render my PDFfile
>
> My problem is with creating the next page.Eventhough I call
> document.nextPage()
> my stuff is rendered on the same page with text of each page overlapping
> the text of the previous page
>
> Here is a sample of my code :
>
>
> //create <file://create> document
> com.lowagie.text.Document document = new com.lowagie.text.Document();
> PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream("fileName.pdf"));
> document.open();
>
> //imageArea <file://imageArea> is the rectangle to draw on and
> //this <file://this> corresponds to one page and is calculated
> //depending <file://depending> on the type of report
> int w = imageArea.width;
> int h = imageArea.height;
>
> PdfContentByte cb = writer.getDirectContent();
>
> // draw using java g2d
> PdfTemplate tp = cb.createTemplate(w, h);
> java.awt.Graphics2D g2d = tp.createGraphics(w, h);
>
> //draw <file://draw> text for the first page
> //from <file://from> point , point.x =0 , point.y = 0
>
> //after <file://after> rendering first page add template
> cb.addTemplate(tp, leftMagin, topMargin);
>
> //go <file://go> to the next Page
> document.newPage();
>
> //start <file://start> rendering next page from
> //point <file://point> point.x = 0, point.y =0
>
> //After <file://After> all pages are rendered
>
> g2d.dispose();
> document.close();
>
> //end <file://end>
>
> Thanks,
>
> nagi
>
>
>
> _____
>
> Do You Yahoo!?
> Yahoo! Shopping <http://rd.yahoo.com/welcome/*http://shopping.yahoo.com> -
> Mother's Day is May 12th!
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions