我找到了一些关于如何在iText中绘制表单的教程,但是我需要将它插入到单元格中,我不知道如何.感谢您对此事的考虑.
由于谷歌没有对这个完整的代码示例做出任何好的回应,我花了很多时间试图弄清楚如何做到这一点(即使现在看起来很明显的Jes解释......)我想我会发布一个例如,进一步的搜索者可以有一个完整的代码示例.
PdfPTable table = new PdfPTable(1);
table.setTotalWidth(450);
PdfTemplate template = cb.createTemplate(30, 30);
template .setLineWidth(0.5f);
template .rectangle(0, 0, 17f, 17f);
template .stroke();
Image img = Image.getInstance(template);
Chunk chunk = new Chunk(img, 1f, 1f);
PdfPCell cell = new PdfPCell();
cell.addElement(chunk);
table.addCell(cell);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7633 次 |
| 最近记录: |