此异常可访问该链接,试过有效,转载自他人
Caused by: com.itextpdf.text.exceptions.BadPasswordException: PdfReader not opened with owner password
at com.itextpdf.text.pdf.PdfStamperImp.(PdfStamperImp.java:109)
at com.itextpdf.text.pdf.PdfStamper.(PdfStamper.java:94)
at com.platform.base.util.PDFFormUtil.fillPDFForm(PDFFormUtil.java:93)
… 1 more
解决方法:
PdfReader reader= new PdfReader(templete);
Field f = PdfReader.class.getDeclaredField(“ownerPasswordUsed”);
f.setAccessible(true);
f.set(reader, Boolean.TRUE);
————————————————
版权声明:本文为CSDN博主「colplayboy」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/colplayboy/article/details/84806537