/** * 去掉证书功能 * @param src * @return * @throws DocumentException * @throws IOException */ public static byte[] manipulatePdf(byte[] src) throws DocumentException, IOException { PdfReader reader = new PdfReader(src); ByteArrayOutputStream baos=new ByteArrayOutputStream(); PdfStamper stamper = new PdfStamper(reader, baos); PdfContentByte overContent = stamper.getOverContent(0); stamper.setFormFlattening(true); stamper.close(); return baos.toByteArray(); }
我用了下这个,签字证书信息是删除掉了,但使用签约域附上的图片信息等并没有删除,使用的官方的代码,没有看到怎么删掉签字域的图片信息的代码,有谁看到或找到其它可用方法,请告知。
以下是官方例子:
http://developers.itextpdf.com/examples/security/clone-remove-digital-signatures