我需要获取pdf文档中已签名字段的数量。现在我这样做:
ServletContext app = getServletContext();
String path = app.getRealPath("/CompesationReportsPdfDocuments/mySignedPdf.pdf");
File thePdf = new File(path);
int numberOfSignedFields=0;
PdfReader reader = new PdfReader(path);
AcroFields fields = reader .getAcroFields();
numberOfSignedFields=fields.getSignatureNames().size();
reader .close();
当我做的时候
System.out.printline("Number of signed fields :"+numberOfSignedFields);
我得到了
Number of signed fields :0
答案 0 :(得分:0)
试试这个。希望它能帮到你:
com.lowagie.text.pdf.PdfReader reader = new com.lowagie.text.pdf.PdfReader("MYPDF.pdf");
int position = reader.getAcroFields().getSignatureNames().size();