- Home
- Testimonials
- Purchase
- Developer Tools
- Desktop Utilities
- Download
- Support
- Blog
- Company
How to remove protection from PDF document using Bytescout.PDF library for .NET applications
Removing protection (password and security permissions) from existing PDF document using Bytescout.PDF library
This example demonstrates how to remove protection and security settings from existing PDF document using Bytescout.PDF library
Download example source code: bytescoutpdf_remove_protection_from_existing_pdf.zip (10 KB)
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Bytescout.PDF;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
// Create main PDF Doc Engine
PDFDocEngine engine = new PDFDocEngine("", "");
// Add existing document
Document document = engine.AddDocument("HelloWorldWithSecurity.pdf");
// check if document is protected
if (document.Protected)
{
// check password
if (document.ValidatePassword("123") == PasswordValidationType.Invalid)
{
Console.WriteLine("Invalid password");
}
else // removing protection if password was correct
document.RemoveProtection();
}
// Save document
document.Save("HelloWorldWithSecurity_ProtectionRemoved.pdf");
}
}
}
Download example source code: bytescoutpdf_remove_protection_from_existing_pdf.zip (10 KB)
Filed in:
PDF SDK for .NET
Tutorials:


