I'm adding a Paragraph to my Document that has an Image within it. The
following code segment adds it, right aligned, with text wrap, and puts some
text around it. This works fine.
Image img = Image.getInstance("image.png");
img.setAlignment(Image.RIGHT | Image.TEXTWRAP);
Paragraph p = new Paragraph();
p.add(img);
for(int i = 0;i < 100;i++)
{
p.add(new Phrase("This is a sentence. "));
}
Now, if I add the following line after my Paragraph object:
p.setKeepTogether(true);
The Image no longer displays. I've tried adding the Image to a Chunk then
adding the Chunk to the Paragraph, but then things get screwy with alignment and
textwrap. I don't want this Paragraph to have any need to know anything about
the page it's being put on, hence trying to use the alignment properties of the
Image object. That also means setting an offset on the Chunk isn't an option,
unless I come up with some convoluted scheme to get a reference to my Document
passed through to the object generating this Paragraph.
Any suggestions or workarounds would be more than welcome.
-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/