Hello,
I created a PDF in c # using namespace PdfSharp pulled off the web.
Now I want to secure the document and set a 'Not Allowed' for a number of security parameters (such as 'Content Copying',' Page Extraction' and more),
and add a digitally sign the document.
All this through code in c #.
Can anyone help?
Thank you!
Loading

Bharat VasantRank #2,126 · 671 reputationPosted Sep 4, 2019, 9:59 PM EDT
George ericRank #9,604 · 204 reputationPosted Jun 6, 2012, 12:03 AM EDT
An alternative choice but commercial one is spire.pdf and I also direct you to a programming guide: How to Create PDF Digital Signature.
Hope the two can help you in this regards.
Mohamed AbedallahRank #2,074 · 697 reputationPosted Sep 12, 2019, 7:00 AM EDT
1. About a year ago, I submitted this answer on how to change the PDF security options:
https://www.c-sharpcorner.com/forums/dev-express-pdf-viewer-control
About digital signature, here is another post where I explained how to sign a PDF and how to check the signature:
https://www.c-sharpcorner.com/Forums/digital-signatures-in-pdf-file
Leon DRank #851 · 2.6K reputationPosted Sep 15, 2019, 4:45 PM EDT
You can use Spire.PDF for .NET library to digitally sign a PDF and set the security permissions at once.
Isla Martis3 reputationPosted Oct 3, 2025, 6:15 AM EDT
To protect your document from various security risks and ensure it remains tamper-proof, you should digitally sign the PDF. A digital signature adds authenticity, integrity, and protection to your file. If you also need a certificate for signing, you can get a Code Signing Certificate from SignMyCode.com.
Tuhin PaulRank #7 · 71.9K reputationPosted Oct 3, 2025, 10:32 PM EDT
This is preety old post. But still relevant. PDFsharp (PdfSharp) has significant limitations when it comes to PDF security and digital signatures:
PDFsharp Limitations
Syncfusion offers comprehensive PDF security and signing features.
Install:
Example:
using Syncfusion.Pdf; using Syncfusion.Pdf.Security; using Syncfusion.Pdf.Graphics; public void SecureAndSignWithSyncfusion(string inputPath, string outputPath) { // Load existing PDF using var document = new PdfLoadedDocument(inputPath); // Set security document.Security = new PdfSecurity(); document.Security.OwnerPassword = "ownerPassword"; document.Security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.Accessible | PdfPermissionsFlags.DocumentAssembly; // This automatically restricts copying, editing, etc. // Save with security document.Save(outputPath); document.Close(); // Note: Digital signing requires additional Syncfusion licensing }