Regarding PdfPCell there's no need to nest tables, each row has 4 cells and that's it. For the barcode create it as an image (BarcodeEAN.createImageWithBarcode() for example) then create a Chunk with it and add the Chunk to the Phrase. For multiple lines add a \n to separate the lines. Table class has no problems with borders, you are missing a TextCell.setBorderWidth(0) and a productImageCell.setBorderWidth(0).
Best Regards, Paulo Soares > -----Original Message----- > From: Norton [SMTP:[EMAIL PROTECTED]] > Sent: Monday, April 29, 2002 17:19 > To: [EMAIL PROTECTED] > Subject: [iText-questions] Table formatting problems > > Hi, > > I'm having trouble with the format of a table I'm > trying to create and was hoping someone here would be > able to help me. > > I'm trying to create a page that looks something like: > > http://decoder.jumptech.com/catsample.html > > I was able to fiddle a bit and get the result I > wanted, but without the barcode. I'm using a > PdfPTable > for the big table with a PdfPTable in each cell. Each > cell PdfPTable contains to PdfPCells, one > for the image, and one for the text. I was able to > add multiple phrases to the text side to get multiple > lines, but PdfPCell doesn't appear to have a way to > add an image so that I can add the barcode image > under the text. Is there a way to do this? > > Ideally, I would like to use the Table class because > we would like to output to RTF as well as PDF. > However, I had a bear of a time trying to get Table to > work. The pseudo code for the Table class > implementation looked like this: > > bigTable = new Table(2, 2); > bigTable.setBorderWidth(1); > bigTable.setPadding(5); > bigTable.setWidth(95); > > for (i=0; i<#ofProducts; i++ ) { > > productImage = Image.getInstance(productImage[i]); > productImageCell = new Cell(productImage); > > barcodeImage = create barcode image; > > textCell = new Cell(productTitle); > > textCell.setHorizontalAlignment(Element.ALIGN_CENTER); > textCell.add(new Paragraph(item.getCatalogId())); > textCell.add(barcodeImage); > > itemTable = new Table(2, 1); > itemTable.setBorderWidth(0); > itemTable.addCell(imageCell); > itemTable.addCell(textCell); > > tableCell = new Cell(itemTable); > > bigTable.addCell(tableCell); > } > > There are two problems that occur with this. First, > the barcode image doesn't get centered like the text > in the texCell. > > Second, I have a problem with the borders. The above > code yields this: > > http://decoder.jumptech.com/badcat.pdf > > As you can see, the "crosshatch" that should be in the > big table is not there, and the inner tables have > borders even when I set the borderWidth to 0. I also > tried setting the borderWidth of the inner table to 10 > and > the border width was still unchanged. > > Did I find a bug? Is there a workaround? > > I don't mind using PdfPTable and PdfPCell for the time > being, but RTF will be a requirement for us in > the future and I would like to get the above code > working sometime soon. > > Thanx in advance for your help. > > BTW, Bruno and Paul, great work on the library. It > generally works great and the documentation on the web > site > is awesome (albeit a little out of date). > > Norton > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Health - your guide to health and wellness > http://health.yahoo.com > > _______________________________________________ > iText-questions mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/itext-questions _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions
