0

我正在尝试在签名的 pdf 上添加“用户定义的外观图标”。如何实施问题?请帮我修复它。谢谢。

4

1 回答 1

2

使用预定义图标创建注释很容易。只需在关键字列表中查找“注释 > 注释图标” :http : //itextpdf.com/themes/keyword.php ?id=294

将这些注释添加到签名的 PDF 是棘手的部分。在某些情况下,如果不破坏签名,这是不可能的,更具体地说,当签名的 MDP 设置阻止添加注释时。在这种情况下,你的问题是无法回答的。

但是,如果 MDP 设置允许添加注释,那么您需要使用PdfStamper附加模式添加注释。在PDF 和数字签名手册中搜索关键字“附加模式”。

public void addAnnotation(String src, String dest)
    throws IOException, DocumentException {
    PdfReader reader = new PdfReader(src);
    PdfStamper stamper =
        new PdfStamper(reader, new FileOutputStream(dest), '\0', true);
    PdfAnnotation comment = PdfAnnotation.createText(stamper.getWriter(),
       new Rectangle(200, 800, 250, 820), "Finally Signed!",
       "Bruno Specimen has finally signed the document", true, "Comment");
    stamper.addAnnotation(comment, 1);
    stamper.close();
}

“Comment”的可能替代值是“Key”、“Note”、“Help”、“NewParagraph”、“Paragraph”和“Insert”。

于 2013-02-21T11:15:37.853 回答