Posted 9 July 2025, 2:45 pm EST - Updated 10 July 2025, 7:13 am EST
We have recently run into a situation that I cannot find an explanation for. We have a new client that is attempting to generate a PDF and on the call to GcPdfDocument.Load the following exception is thrown:
Unexpected exception occurred while parsing PDF document. Could not load file or assembly ‘BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938’ or one of its dependencies. The system cannot find the file specified.
The snippet of C# code that is throwing this exception is:
[code] GcPdfDocument form = new GcPdfDocument();
try { form.Load(ms); } catch (Exception ex) { throw; }[/code]
We don’t have any references to BouncyCastle in our API and we do not deploy this DLL with our solution. I have obtained a copy of the PDF being processed and can process it in my development environment so I don’t think there is anything particular to this PDF that requires some type of crypto processing.
Can anyone help determine why we might be seeing this exception?
Thank you!