Increase the cell padding. 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Eryan Yu
> Sent: Friday, September 23, 2005 11:58 AM
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] Problem with Image overlaping the 
> table border
> 
> Hi all,
> 
> When i add an image to a PdfPTable, the image will block the 
> border of the table. I am going to attach the code, and the 
> generated PDF.
> 
> would you give me a little hints of how can i avoid this?
> 
> thanks.
> 
> Codes:
>  Document document = new Document(PageSize.A4, 20, 20, 20, 20);
>         try {
>             // step2
>             PdfWriter writer = PdfWriter.getInstance(document,
>                     new FileOutputStream("AddBigTable.pdf"));
>             // step3
>             document.open();
>             PdfContentByte cb = writer.getDirectContent();
>             
>             //add company logo
>             Image logo = Image.getInstance(logoFilename);
>             logo.setAbsolutePosition(280, 720);
>             document.add(logo);
>             
>             //add barcode
>             BarcodeEAN codeEAN = new BarcodeEAN();
>             codeEAN.setCodeType(Barcode.EAN13);
>             codeEAN.setCode(barcode);
>             Image imageEAN = 
> codeEAN.createImageWithBarcode(cb, null, null);
>             document.add(imageEAN);
>             
>             
>             //add address
>             Font addressFont = new Font(Font.COURIER, 8, Font.NORMAL);
>             Paragraph address = new Paragraph(addressText, 
> addressFont );
>             document.add(address);
>             
>             //add table
>             PdfPTable datatable = new PdfPTable(6);
>             int headerwidths[] = { 10,30,15,20,15,10 }; // percentage
>             datatable.setWidths(headerwidths);
>             datatable.setWidthPercentage(100);
>             
>             
>             
>             PdfPCell cell = new PdfPCell(new 
> Paragraph("Invoice I10325"));
>             cell.setColspan(6);
>             datatable.addCell(cell);
>             datatable.addCell(" ");
>             datatable.addCell("Catalogue no");
>             datatable.addCell("Quantity ");
>             datatable.addCell("Price Unit ");
>             datatable.addCell("Net Value ");
>             datatable.addCell("Rate ");
>             
>             datatable.addCell("Item 1");
>             datatable.addCell("C001/15 ");
>             datatable.addCell("2 ");
>             datatable.addCell("12.00 ");
>             datatable.addCell("24.00 ");
>             datatable.addCell("17.50 ");
>             
>             datatable.addCell(" ");
>             datatable.addCell(" Apple iPod mini");
>             datatable.addCell(" ");
>             datatable.addCell(" ");
>             datatable.addCell(" ");
>             datatable.addCell(" ");
>             
>             
>             Image ipod = Image.getInstance("ipod.jpeg");
>             ipod.scaleToFit(80, 60);
>             PdfPCell cell2 = new PdfPCell(ipod);
>             cell2.setColspan(6);
>             cell2.setHorizontalAlignment(Element.ALIGN_CENTER);
>             datatable.addCell(cell2);
>             
>             datatable.addCell("Item 2");
>             datatable.addCell("C001/16 ");
>             datatable.addCell(" 2 ");
>             datatable.addCell(" 200.00");
>             datatable.addCell(" 400.00");
>             datatable.addCell(" 17.50");
>             
>             datatable.addCell(" ");
>             datatable.addCell(" Apple iPod mini");
>             datatable.addCell(" ");
>             datatable.addCell(" ");
>             datatable.addCell(" ");
>             datatable.addCell(" ");
>             
>             datatable.addCell(cell2);
>             document.add(datatable);
>         }catch (Exception e){e.printStackTrace();}
>         
>         document.close();
> 
> 


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to