Hello, there is an error [Error loading object: misaligned object] prompted when open a PDF by PDF-XChange. The PDF file was encrypted by PdfFileSecurity.encryptFile(). Before the encryption, it can be opened normally without the error prompt. So, I doubt that there is something went wrong after the encryption.
The library we used is [aspose-pdf-kit-4.2.0.jar] and this library required a license.
Here is the snip code:
try {
java.io.InputStream in = getClass().getResourceAsStream(“Aspose.Total.Java.lic”);
com.aspose.pdf.kit.License license = new com.aspose.pdf.kit.License();
license.setLicense(in);
String newFilePath = "";
PdfFileSecurity fileSecurity = new PdfFileSecurity(filePath, newFilePath);
fileSecurity.encryptFile(pwd, pwd, PdfPrivilege.AllowAll, false)
} catch (Exception e) {
System.err.println("Aspose PDF Error: "+e.toString());
}
Btw, understand that the library may be out of date, is there any cost if we would like to update it.
Thank you.