附件字体和图标大小

时间:2012-08-28 08:13:32

标签: java pdf itext

我正在使用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上生成一个小的回形针图标。

如何让图标变大,以便更加明显?我希望它的尺寸​​更大。

1 个答案:

答案 0 :(得分:0)

根据documentation第二个参数rect设置注释页面中的维度。您可以使用更大的rect调用该方法,以使图标更大。

只是为了第一次测试,它看起来非常大(500x500):

PdfAnnotation annotation = PdfAnnotation.createFileAttachment(writer, new Rectangle(500, 500), "Click to open" , null, attac.get(index),  attac.get(index));

我希望这会让图标更大。

相关问题