文字中的图像对齐?

Kyl*_*yle 12 itextsharp

使用iTextSharp我正在尝试对齐图像,使其嵌入段落中.我可以这样做:

iTextSharp.text.Image image;
image.Alignment = Image.ALIGN_RIGHT | Image.TEXTWRAP;
document.Add(image);
document.Add(new Paragraph("Large string of text goes here"));
Run Code Online (Sandbox Code Playgroud)

但是图像出现在右上方,周围有文字(有点像L)

我想要的是文本是几段然后是下面有文字的图像(有点像C).有谁知道我会怎么做这个威盛iTextSharp?

编辑:

我也试过了

iTextSharp.text.Image image;
image.Alignment = Image.ALIGN_RIGHT | Image.TEXTWRAP | Image.ALIGN_MIDDLE;
document.Add(image);
document.Add(new Paragraph("Large string of text goes here"));
Run Code Online (Sandbox Code Playgroud)

但它显示在顶部的图像和它下面的文本.没有textwrap生效.

Ste*_*bob 15

短语和段落对象的行为方式不同.尝试更改为:

image.Alignment = 6;
document.Add(image);
document.Add(new Phrase("Large string of text goes here"));
Run Code Online (Sandbox Code Playgroud)

这在VB中对我有用.(我不得不将图像对齐更改为ALIGN_RIGHT和TEXTWRAP的整数值之和,以使其正常工作).

ALIGN_RIGHT = 2
TEXTWRAP = 4
Run Code Online (Sandbox Code Playgroud)

您的图像显示在页面顶部,因为它是第一个添加到文档中的内容,文本是在其后添加的.您可以通过设置其绝对位置或向文档中添加一些文本,然后添加图像,然后添加其余文本来向下移动图像.