段落之间的图像使用iText [英] Image in between a paragraph Using iText

查看:215
本文介绍了段落之间的图像使用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:


  1. 使用 image.setAlignment(Image.LEFT | Image.TEXTWRAP); 并将图像添加到文档中(而不是 Chunk 段落)。这将把图像添加到左侧并包围其周围的其他文本。

  2. 在绝对位置添加图像,并使用 ColumnText for 不规则列 http://1t3xt.be/?0b3

  1. Use image.setAlignment(Image.LEFT | Image.TEXTWRAP); and add the image to the document (not to a Chunk or Paragraph). This will add the image to the left and wrap the other text around it.
  2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆