I've attached the two PDFs that the below code generated.  So you can
see what I am talking about.  

Note: using PdfPTable and PdfPCell doesn't fix the problem.

-Ryan




-----------------------------------
Ari,

I did some investigation; this isn't a problem for iText v. 1.02b and
earlier, it only affects v1.1 and later.

I wrote the following test code to prove your bug to myself, I ran it
with both 1.02b and 1.1:

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;

import com.lowagie.text.Cell;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Image;
import com.lowagie.text.Table;
import com.lowagie.text.pdf.PdfWriter;

public class ITextCellTester{
        
        
        public static void main(String[] args)throws Exception {
                ITextCellTester app = new ITextCellTester();
                app.testPDF();
        }
        private void testPDF()throws Exception{
                
                try {
                        OutputStream out = new BufferedOutputStream(new
FileOutputStream("iTextTest.pdf"));
                        Document doc = new Document();
                        PdfWriter.getInstance(doc, out);
                        doc.open();
                        Cell cell = null;
                        Table table = new Table(2);
                        
                        //row 1
                        table.addCell("1 (Text without image)");
                        table.addCell("Sample Text");
                        
                        //row 2
                        Image jpg = Image.getInstance("test.jpg");
                        table.addCell("2 (Image without Text");
                        cell = new Cell(jpg);
                        table.addCell(cell);
                        
                        //row 3
                        Image jpg2 = Image.getInstance("test.jpg");
                        table.addCell("3 (Image and Text same cell)");
                        cell = new Cell();
                        Chunk chunk = new Chunk("Sample Text");
                        cell.add(chunk);
                        cell.add(jpg2);
                        table.addCell(cell);
                        doc.add(table);
                        doc.close();
                        out.close();
                        //Runtime rt = Runtime.getRuntime();
                        //rt.exec(new String[]{"C:/Program
Files/Adobe/Acrobat 5.0/Reader/AcroRd32.exe", 

"C:/workspace/ITextTester/myPDF.pdf"});
                        
                } catch (DocumentException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
        }
}

using 1.02b- the 3rd row features the text with the image below it as
expected; using 1.1+ 
the image and the text float over each other.  
 
Does anyone have an idea what would be the cause of this problem??

Thanks,

Ryan

----------------------------------------------
>From: Ari <[EMAIL PROTECTED]>
>Image overlapping text in PDF table cell  
>2005-08-15 16:11
>Hello.
>
>I recently upgraded to the latest IText.jar and am now unable to put an
image 
>and text in the same PDF table cell.  The image "floats" over the text
and 
>other cell borders as well.  Has anyone seen this sort of thing?
>
>Thank you
>Ari

Attachment: samplefromIText1.02b.pdf
Description: samplefromIText1.02b.pdf

Attachment: samplefromIText1.1.pdf
Description: samplefromIText1.1.pdf

Reply via email to