且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Android中将图像添加到iText pdf

更新时间:2022-06-24 08:29:13

使用图像创建Chunk确实是一种方法.请看一下ZUGFeRD教程的这一章:

Creating a Chunk with an image is indeed the way to go. Please take a look at this chapter of the ZUGFeRD tutorial: Creating PDF/A files with iText

它有一个示例,该示例使用以下图像创建文本:

It has an example that creates text with images that look like this:

这是完成的方式:

Paragraph p = new Paragraph();
Chunk c = new Chunk("The quick brown ");
p.add(c);
Image i = Image.getInstance("resources/images/fox.bmp"");
c = new Chunk(i, 0, -24);
p.add(c);
c = new Chunk(" jumps over the lazy ");
p.add(c);
i = Image.getInstance("resources/images/dog.bmp"");
c = new Chunk(i, 0, -24);
p.add(c);
document.add(p);

我希望这会有所帮助.