I don't see anything wrong. Post self contained code that reproduces the error.
----- Original Message ----- From: "Hanes Jedidiah A1C AU/SCIE" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Monday, June 27, 2005 9:16 PM Subject: [iText-questions] Help with PdfContentByte > Please help. > > I'm using PdfContentByte to position text (which are variables filled from a > list) on my screen. They are basically name plates with two per page. > Problem is only the last page is showing up ... its like the contentbyte is > overwritten... how do i stop this from happening. If I take away the new > page command the loop works fine, just writes on top of itself on one page. > When I have the new page in there it does crazy stuff... like blank pages > and even one page that is set at zoom 4444% or something. > > > > Sample code: > > > > for (int i=0; i < students.size(); i++) > > { > > //Grab student > > StudentPerson student = (StudentPerson) students.get(i); > > String lname = student.getLastName(); > > String fname = student.getFirstName(); > > String service = student.getServiceComponent() > > String borderTop= "____________________________"; > > String borderBottom = "BLABLABAHABLAHABALHABLA"; > > > > PdfContentByte cb = writer.getDirectContent(); > > BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA_BOLD, > BaseFont.CP1252, BaseFont.NOT_EMBEDDED); > > cb.beginText(); > > > > if(topRecord == true) > > { > > sealDod.setAbsolutePosition(25, 350); > > sealDod.scaleAbsolute(200, 200); > > addElement(sealDod); > > cb.setFontAndSize(bf, 24); > > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, fname, > 500, 425, 0); > > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, lname, > 500, 375, 0); > > cb.showTextAligned(PdfContentByte.ALIGN_LEFT, service, > 25, 350, 0); > > cb.setFontAndSize(bf, 18); > > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, > borderTop, 475, 350, 0); > > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, > borderBottom, 475, 325, 0); > > topRecord = false; > > } > > else > > { > > sealDod.setAbsolutePosition(25, 50); > > sealDod.scaleAbsolute(200, 200); > > addElement(sealDod); > > cb.setFontAndSize(bf, 24); > > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, fname, > 500, 125, 0); > > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, lname, > 500, 75, 0); > > cb.showTextAligned(PdfContentByte.ALIGN_LEFT, service, > 25, 50, 0); > > cb.setFontAndSize(bf, 18); > > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, > borderTop, 475, 50, 0); > > cb.showTextAligned(PdfContentByte.ALIGN_CENTER, > borderBottom, 475, 25, 0); > > topRecord = true; > > } > > cb.endText(); > > > > //Every 2 records create a new page > > if(i % 2 == 1) > > { > > //Then create new page > > //newPage(); > > } > > } > > closeDocument(); > > > > > > Thanks > > ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
