Open jmanm opened 5 years ago
Hi, by any chance have you found some solution for this issue? Thanks
No I have not. I haven't looked at it in a few months, but so far I've tried:
But no luck.
I have managed to track this down. This comes from PdfDictionary.TryUnfilter()
which tries to call Filtering.Decode(...)
where FlateDecode
tries to use the embedded SharpZipLib to decompress the stream. However, the value is still encrypted, and needs to be decrypted. Catching the exception and decrypting and retrying works for me.
New code:
byte[] bytes;
try {
bytes = Filtering.Decode(_value, filter);
} catch (SharpZipBaseException) {
_ownerDictionary._document.SecurityHandler.DecryptObject(_ownerDictionary);
bytes = Filtering.Decode(_value, filter);
}
I have not submitted a pull request because this fix is a bit weird.
My changes can be seen at https://github.com/sisve/PDFsharp-netstandard2.0/commit/6227b9f163f1c53add12faaf95fb55ed39c88b15
Tested using Acrobat Pro DC version 2019.010.20069.
Steps to reproduce: