我正在使用 IText 将附件添加到 pdf 文件,如下所示:
document.add(new Paragraph(attac.get(index).toString()));
chunk = new Chunk("\u00a0\u00a0");
PdfAnnotation annotation = PdfAnnotation.createFileAttachment(writer,rect, "Click to open" , null,
attac.get(index),
attac.get(index));
annotation.setColor(BaseColor.BLUE);
annotation.setAppearance(new PdfName(""), template);
chunk.setAnnotation(annotation);
document.add(chunk);
这会在创建的 pdf 上生成一个小回形针图标。
如何使图标更大以便更明显?我希望它的尺寸更大。
最佳答案
根据documentation第二个参数rect
设置注释页面中的尺寸。您可以使用更大的矩形来调用该方法,以使图标更大。
仅用于第一次测试,使其看起来非常大(500x500):
PdfAnnotation annotation = PdfAnnotation.createFileAttachment(writer, new Rectangle(500, 500), "Click to open" , null, attac.get(index), attac.get(index));
我希望这将使图标更大。
关于java - 附件字体和图标大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12155235/