This is very similar to CELLSJAVA-45271, which you already fixed (thanks for that), just for Microsoft pptx files.
We’re using Aspose Slides for Java to remove passwords from Powerpoint (pptx) documents. We noticed that when we process the same password protected file twice, we get two unprotected files whose content isn’t binary identical. When comparing the contents of the created pptx files, we found a different dcterms:modified date in the core.xml. The date is set to the time when we removed the password.
I guess, technically the created pptx file is a new and modified pptx file. So, a new modification date might be expected. For our usecase (search engine with de-duplication, etc.) this is problematic.
Is the “current” date as modification date intended?
Our code looks likes this
LoadOptions loadOptions = new LoadOptions();
loadOptions.setPassword(pw);
Presentation presentation = new Presentation(is, loadOptions);
try {
presentation.getProtectionManager().removeEncryption();
try (OutputStream os = new FileOutputStream(...)) {
int saveFormat;
switch (presentation.getSourceFormat()) {
case SourceFormat.Pptx:
case SourceFormat.Ppt:
saveFormat = SaveFormat.Pptx;
break;
case SourceFormat.Odp:
saveFormat = SaveFormat.Odp;
break;
default:
throw new UnsupportedOperationException();
}
presentation.save(os, saveFormat);
} catch (Exception e) {
unprotected.release();
throw e;
}
return Optional.of(...);
} finally {
presentation.dispose();
}
input.zip (3.8 MB)
output.zip (7.1 MB)