I am trying to remove existing security and add a different password. Basically, I want to remove the user password and replace the owner password. The following code does not work, the existing user password remains:
Code: C#
PdfDocumentSecurity security = new PdfDocumentSecurity("123");
PdfDocument doc = new PdfDocument(file, security);
doc.Save(Path.Combine(encryptedPath, baseFileName));
I have tried removing the old password and replacing the owner password in one step by overwriting the existing file, saving the PDF to a new directory between these two steps, setting the user pass to an empty string, nothing. The user pass persist no mater what. Any help is appreciated.