Paolo Scaffardi wrote:

>I have some problem with images inside PdfTable cells.
>
>This is part of my code:
>
>public PdfPCell getCell(String text, URL iconUrl) {
>       PdfPCell cell = new PdfPCell();
>       if (text != null) {
>               Phrase phrase = new Phrase(text);
>               cell.setPhrase(phrase);
>       }
>       
>       if (iconUrl != null) {
>               com.lowagie.text.Image image =
>com.lowagie.text.Image.getInstance(iconUrl);
>               cell.setImage(image);
>       }
>       return cell ;
>}
>
>When i got an image WITHOUT text, the image is scaled very BIG to fit
>COLUMN WIDTH. When i got BOTH text and image, the text is never shown.
>
>How can i fix the image size to correct ratio and make the text visible?
>Why is it so difficult?
>
Because you mix 'text mode' with 'composite mode'
(this causes your text to disappear) and because
you should create your image cell like this:
new PdfPCell(img, false);
Check the Javadocs to know what the boolean does.
This is explained in chapter 6 of the book.
It is available in Early Access at Manning.
br,
Bruno

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to