将文本和所有对齐的图像添加到ColumnText Itext [英] Add text and an alligned image to a ColumnText Itext

查看:1007
本文介绍了将文本和所有对齐的图像添加到ColumnText Itext的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从右到左书写文字。

I am writing text from right to left.

如何在文本末尾添加图片(很好地签名)?

how can i add an image at the end of the text (alligned nicely)?

推荐答案

问题并不完全清楚。

添加到文档的对象的顺序总是受到尊重,除了 Image 对象。如果 Image 对象不适合页面,则可以将其转发到下一页,并且可以先添加其他内容。如果你想避免这种情况,请使用 writer.setStrictImageSequence(true);

The order of objects added to a Document is always respected, except in the case of Image objects. If an Image object doesn't fit the page, it can be forwarded to the next page, and other content can be added first. If you want to avoid this, use writer.setStrictImageSequence(true);

但是:你是从从右到左(可能是希伯来语),所以上述不适用,而不是安舒以前的答案。您只能在 ColumnText PdfPTable 中使用RTL。

However: you're writing from Right to Left (probably in Hebrew), so the above doesn't apply, not the previous answer by Anshu. You can only use RTL in ColumnText and PdfPTable.

目前还不清楚你想做什么。

It's not clear what you want to do.

你想在底部添加一个 Image 文本?这很简单:只需先添加文本,然后添加图像。要添加图像内联吗?在这种情况下,您可以将 Image 包装在 Chunk 中,如下例所示: http://itextpdf.com/examples/iia.php?id=54

Do you want to add an Image at the bottom of the text? That's easy: just add the text first, then add the Image. Do you want to add an Image inline? In that case, you can wrap the Image in a Chunk as is done in this example: http://itextpdf.com/examples/iia.php?id=54

我的解释是:您想要在左下方添加图像,并希望在图像旁边添加文本。这更难实现。您需要分别添加图像和文本。在绝对位置添加图像,并使用不规则列添加文本。即:文本模式中的 ColumnText (与复合模式相反)。有关如何使用不规则列的示例,请参阅 http://itextpdf.com/examples/ iia.php?id = 67

My interpretation is: you want to add the image at the bottom left, and you want the text to be added next to the image. That's more difficult to achieve. You'd need to add the Image and the text separately. Add the Image at an absolute position and add the text using 'irregular columns'. That is: ColumnText in text mode (as opposed to composite mode). For an example showing how to use irregular columns, see http://itextpdf.com/examples/iia.php?id=67

这篇关于将文本和所有对齐的图像添加到ColumnText Itext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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