On 20/06/2012 13:08, Çağatay Yıldız wrote: > I am new to iText and faced with a real interesting case about adding > external images to a paragraph. Here is the thing: > > img.setAlignment(Image.LEFT| Image.TEXTWRAP); > p.add(new Chunk(img2, 0, 0, true)); > gives me the picture and "Hello Worlddd!" string below. However, > > img.setAlignment(Image.LEFT| Image.TEXTWRAP); > p.add(img); > gives me the picture and string "Hello worlddd!" located on the right > hand side of the picture and one line above it. > > So, I am really confused. What is the logic behind that difference.
(Assuming you meant "new Chunk(img,0,0,true)" in your first example, instead of img2) If you add an image directly, its alignment properties (set with setAlignment()) are taken into account. If you wrap the image in a Chunk it is handled as if it were a chunk of text. So the alignment properties, specific to images, are lost. Best regards, Raf ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
