PDF操作用のデスクトップアプリケーションを1つ作成しています。このアプリケーションでは、Merge PDF という要件が 1 つあります。PDF操作にICEPDF 4.3.3 jarを使用しています。私のコードは、暗号化された 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 jar ファイルを使用しています
その時点で暗号化されたファイルを他のPDFファイルとマージすると、以下のエラーメッセージが表示されました
ICEPDF could not open the encrypted file, This may be the result of an invalid password or missing JCE Security Provider
コードでパスワードなしで暗号化されたPDFファイルをマージする方法はありますか?