Image in between a paragraph Using iText

自古美人都是妖i 提交于 2019-12-21 20:46:38

问题


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:

I have tried Chunk class and Paragraph class but i am not able to get the desired. Any ideas?


回答1:


You have (at least) two options:

  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 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.



来源:https://stackoverflow.com/questions/13030250/image-in-between-a-paragraph-using-itext

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!