Nutrient .NET SDK
Need pricing or implementation help? Talk to Sales.
PDF SECURITY IN C#
using GdPicture14;
using GdPicturePDF pdf = new GdPicturePDF();pdf.LoadFromFile(@"C:\temp\source.pdf", false);
// Check whether the PDF is password protected/encrypted.if (pdf.IsEncrypted()){ // Provide the user or owner password to unlock it. GdPictureStatus status = pdf.SetPassword("user"); if (status == GdPictureStatus.OK) { bool stillEncrypted = pdf.IsEncrypted(); // false once unlocked Console.WriteLine($"Still encrypted: {stillEncrypted}"); }}using GdPicture14;using System.IO;
using GdPicturePDF pdf = new GdPicturePDF();using MemoryStream output = new MemoryStream();
pdf.LoadFromFile(@"C:\temp\source.pdf");
// Encrypt with 128-bit AES, set an owner password, and lock down permissions.GdPictureStatus status = pdf.SaveToStream( output, PdfEncryption.PdfEncryption128BitAES, "", // user (open) password "owner", // owner (permissions) password CanPrint: true, CanCopy: false, CanModify: false, CanAddNotes: false, CanFillFields: true, CanCopyAccess: false, CanAssemble: false, CanPrintFull: false);
if (status != GdPictureStatus.OK){ Console.WriteLine($"Encrypt failed: {status}");}using GdPicture14;
using GdPicturePDF gdpicturePDF = new GdPicturePDF();gdpicturePDF.LoadFromFile(@"C:\temp\source.pdf");
// Search for sensitive text and mark it for redaction.int occurrences = 0;gdpicturePDF.SearchAndAddRedactionRegions( "Sensitive Information", true, 0, 0, 0, 255, ref occurrences);
// Permanently remove the matched content.if (occurrences > 0){ gdpicturePDF.ApplyRedaction();}
gdpicturePDF.SaveToFile(@"C:\temp\output.pdf");Protect PDFs with AES encryption and user/owner passwords so only the right people can open or change them.
Allow or restrict printing, copying, editing, annotating, form filling, and assembly per document.
Check whether a PDF is encrypted. Then provide a user or owner password to unlock it for processing.
Permanently remove sensitive text and content from a document — not just hide it.
Save a PDF with AES encryption and user and/or owner passwords to control who can open and edit it.
PdfEncryptionDecide exactly what users can do — print, copy, modify, annotate, fill forms, or assemble pages.
CanPrint, CanCopy, CanModify, and more
Check whether a document is password protected. Then supply the password to open it for processing.
IsEncrypted() check after loadingSetPassword() with user or owner passwordfalse once unlockedSearch for and permanently remove confidential text and data before sharing a document.
A user (open) password controls who can view a document; an owner (permissions) password controls what they can do with it. Set either or both, and configure each permission independently. All security APIs are available in C# and VB.NET.
128-bit AES User password Owner password Print Copy Modify Annotate Fill fields Assemble IsEncrypted SetPassword SaveToStream PdfEncryption HOW IT WORKS
Load a document, and save it with an encryption level, passwords, and a permission set — or check an incoming file with IsEncrypted and unlock it with SetPassword. Combine with redaction and digital signatures for end-to-end document security.
Save with PdfEncryption and user/owner passwords so the document is protected at rest and in transit.
Independently allow or deny printing, copying, editing, annotating, form filling, and assembly.
Use IsEncrypted to test an incoming PDF and SetPassword to open it before processing.
Encryption isn’t available for PDF/A documents, since the standard prohibits it — plan archival flows accordingly.
Load the PDF and call IsEncrypted() on the
GdPicturePDF object — it returns true
for an encrypted (password-protected) document. If it’s encrypted,
call SetPassword() with the user or owner password to
unlock it; IsEncrypted() then returns false. See the
loading guide for more information.
Load the document and save it with an encryption overload — for
example, SaveToStream (or SaveToFile)
with PdfEncryption.PdfEncryption128BitAES, a user
password, an owner password, and a set of permission flags. The
result is an encrypted PDF that requires the password to open or
edit.
A user (open) password is required to open and view a document. An owner (permissions) password controls what a viewer can do — print, copy, edit, and so on. You can set either or both; with only an owner password, the PDF opens freely but actions stay restricted until the owner password is supplied.
Yes. When you encrypt, you set independent permission flags such
as CanPrint, CanCopy,
CanModify, CanAddNotes,
CanFillFields, CanAssemble, and
high-resolution printing. These are enforced for users who open
the document with the user password.
Load the file, confirm it’s encrypted with
IsEncrypted(), and call SetPassword()
with the correct user or owner password. Once the password is accepted,
you can read, modify, and resave the document like any other PDF.
The SDK encrypts PDFs using the PdfEncryption
options, including 128-bit AES. Note that encryption isn’t available
for PDF/A documents, because the PDF/A standard doesn’t permit encryption.
Yes. Beyond encryption, the SDK can redact sensitive content (permanent removal) and add digital signatures for integrity and authenticity — covering the full document security workflow.
Yes. Get started with a free trial of the .NET SDK. Then contact Sales for pricing or a production license.
More .NET SDK capabilities
Security guides