Hi folks - i have a set of code that uses iText to place fields on a form (in fact, it's a badge for a convention). The fields are laying out in absolute positions on the document, but I want to add a block that wraps text within the block (for a long badge name, for example).
The entire codeblock is posted here: http://pastebin.stonekeep.com/11527 The boiled down version is this: 1) I create PdfContentByte 'cb' on a Document 2) Using lines like this, I place 'badge rows' (br) where i want them: cb.showTextAligned(PdfContentByte.ALIGN_LEFT,printElement,br.getPosx(),br.getPosy(),0); I have a cb.beginText(); and a cb.endText() around the entire logic. This all works great until I try and place a 'block' item, which uses this code: logger.debug("Printing field " + fname + " using block layouts."); // This first block simpley draws an 'X' across the field area I want to use. This renders fine... cb.setLineDash(6, 0); cb.setLineWidth(1); cb.moveTo(br.getPosx() - (br.getWidth() / 2),br.getPosy() - (br.getHeight() / 2)); cb.lineTo(br.getPosx() + (br.getWidth() / 2),br.getPosy() + (br.getHeight() / 2)); cb.moveTo(br.getPosx() + (br.getWidth() / 2),br.getPosy() - (br.getHeight() / 2)); cb.lineTo(br.getPosx() - (br.getWidth() / 2),br.getPosy() + (br.getHeight() / 2)); cb.stroke(); Font btFont = new Font(bf,br.getFontSize(),Font.NORMAL); Phrase blockText = new Phrase(15,printElement,btFont); ColumnText ct = new ColumnText(cb); ct.setSimpleColumn(br.getPosx()-(br.getWidth() / 2), br.getPosy()-(br.getHeight() / 2), br.getPosx()+(br.getWidth() / 2), br.getPosy()+(br.getHeight() / 2), 19, Element.ALIGN_CENTER); ct.addText(blockText); ct.go(); If this code executes, all OTHER fields on the document disappear, and I end up with just a few characters of the field, with the X through it, and nothing else on the document. What am I doing wrong? Thanks... -dave ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php