pdfbox: trying to decrypt PDF
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Following this answer I'm trying to decrypt a pdf-document with pdfbox: PDDocument pd = PDDocument.load(path); if(pd.isEncrypted()){ try { pd.decrypt(""); pd.setAllSecurityToBeRemoved(true); } catch (Exception e) { throw new Exception("The document is encrypted, and we can't decrypt it."); } This leads to Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider at org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1601) at org.apache.pdfbox.pdmodel.PDDocument.decrypt