-
How to remove restrictions for a secured PDF..? C#
about 9 years ago
-
about 9 years ago
Hi,
The password of secured PDF is mandatory to copy its content. You can open PDF file by this method: Spire.Pdf.PdfDocument(string filename, string password) Then, modify passwords by resetting owner password and user password as empty. Below shows the whole code of modifying passwords of secured PDF file,
//load a encrypted file and decrypt it string input = @"C:\xxxx\2006-Catalog.pdf"; string output = @"C:\xxxx\Unlocked-2006-Catalog.pdf "; PdfDocument doc = new PdfDocument(input, "password"); //reset PDF passwords and set user password permission doc.Security.OwnerPassword = ""; doc.Security.UserPassword = ""; doc.Security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.FillFields; //Save pdf file. doc.SaveToFile(output); doc.Close();
if you find the answer helpful please mark it correct, so that, other developmentnt community can take advantage.
-
-
over 8 years ago
Use iTextSharp which works better & easy with many features.
-
2 Answer(s)