Put the image inside a Chunk and add the Chunk to the Paragraph. Note that
if the image is too big it won't show.

----- Original Message ----- 
From: "Jerry Heinz" <[EMAIL PROTECTED]>
To: <itext-questions@lists.sourceforge.net>
Sent: Thursday, May 12, 2005 7:22 PM
Subject: [iText-questions] Image in Paragraph in PdfPCell


I'm having some trouble with the following code:

PdfPTable t = new PdfPTable();
t.addCell(new PdfPCell(new Paragraph(new Chunk("Sam"))));
Paragraph p = new Paragraph();
Properties attributes = new Properties();
attributes.put (ElementTags.URL,"C:/temp/3044770_EE3.gif");
try {
p.add(Image.getInstance(attributes));
} catch (Exception e1) {
e1.printStackTrace();
}
t.addCell(new PdfPCell(p));

Adding the image to a paragraph before adding it to the table cell
causes the image to not appear in the pdf. However if I add the image
directly to the cell thusly:

PdfPTable t = new PdfPTable();
t.addCell(new PdfPCell(new Paragraph(new Chunk("Will"))));
Paragraph p = new Paragraph();
Properties attributes = new Properties();
attributes.put(ElementTags.URL,"C:/temp/3044770_EE4.gif");
try {
t.addCell(new PdfPCell(Image.getInstance(attributes)));
} catch (Exception e1) {
e1.printStackTrace();
}

... The image appears with no problem. In the first code snippet, no
exceptions are thrown and when I look at the object from a debugger,
everything seems to be added fine in both cases. Can someone point me
toward a way that I can add images within a paragraph in a table? Thanks
in advance for your help!

Jerry


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_ids93&alloc_id281&op=ick
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to