段落之间的图像使用iText [英] Image in between a paragraph Using iText
问题描述
我正在使用iText生成我的自定义.pdf文档。我尝试了很多,但我无法获得包含图像的文本的理想设计。我需要一个如下所示的输出:
I am using iText to generate my custom .pdf document. I tried a lot but i am not able to do get a desired design of my text which includes an image. I need an output just like shown below:
我尝试过Chunk class和Paragraph类,但我无法得到所需的。有什么想法吗?
I have tried Chunk class and Paragraph class but i am not able to get the desired. Any ideas?
推荐答案
你有(至少)两个选择:
You have (at least) two options:
- 使用
image.setAlignment(Image.LEFT | Image.TEXTWRAP);
并将图像添加到文档中(而不是Chunk
或段落
)。这将把图像添加到左侧并包围其周围的其他文本。 - 在绝对位置添加图像,并使用
ColumnText $添加文本c $ c> for 不规则列: http://1t3xt.be/?0b3
- Use
image.setAlignment(Image.LEFT | Image.TEXTWRAP);
and add the image to the document (not to aChunk
orParagraph
). This will add the image to the left and wrap the other text around it. - Add the image at an absolute position, and add the text using
ColumnText
for irregular columns: http://1t3xt.be/?0b3
1是最简单的方法,但结果可能并不总是你想要的(你可以调整一些东西,比如添加一个人); 2需要更多工作,但允许您以您想要的方式创建输出。
1 is the easiest way, but the result may not always be what you desire (you can tweak some things, such as adding a borden); 2 demands more work, but allows you to create the output exactly the way you want to.
这篇关于段落之间的图像使用iText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!