0

我正在为 PDF 操作创建一个桌面应用程序。在此应用程序中,有一个要求是合并 PDF。我正在使用 ICEPDF 4.3.3 jar 进行 PDF 操作。除了加密的 PDF 文件外,我的代码对于 MERGE PDF 工作正常。我的代码如下

File directoryPath = new File(PATH + "Desktop"+File.separator+"pdf executable"+File.separator+"01"); 
String[] files = directoryPath.list();
if (files != null && files.length > 0) {
    for (int i = 0; i < files.length; i++) {
        files[i] = directoryPath.getAbsolutePath() + File.separator + files[i];
    }
}
// Converted all pdf files to list of InputStream
OutputStream outputStream = new FileOutputStream(new File(path + "MERGED.pdf"));
PdfCopyFields copy = new PdfCopyFields(outputStream);

for (InputStream in : list) {
    PdfReader reader = new PdfReader(in);
    copy.addDocument(reader);
}
copy.close();

我正在使用 ICEPDF-core-4.3.3 和 ICEPDF-viewer-4.3.3 jars 文件

当我当时将加密文件与其他 pdf 文件合并时,我收到以下错误消息 ICEPDF could not open the encrypted file, This may be the result of an invalid password or missing JCE Security Provider

有没有办法通过代码合并没有密码的加密pdf文件?

4

0 回答 0