ByteScout PDF Suite - C# - Remove password and protection from pdf with pdf sdk - ByteScout

ByteScout PDF Suite – C# – Remove password and protection from pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – C# – Remove password and protection from pdf with pdf sdk

How to remove password and protection from pdf with pdf sdk in C# with ByteScout PDF Suite

If you want to learn more then this tutorial will show how to remove password and protection from pdf with pdf sdk in C#

The sample source code below will teach you how to remove password and protection from pdf with pdf sdk in C#. Want to remove password and protection from pdf with pdf sdk in your C# app? ByteScout PDF Suite is designed for it. ByteScout PDF Suite is the bundle that provides six different SDK libraries to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript.

The following code snippet for ByteScout PDF Suite works best when you need to quickly remove password and protection from pdf with pdf sdk in your C# application. Just copy and paste the code into your C# application’s code and follow the instructions. This basic programming language sample code for C# will do the whole work for you to remove password and protection from pdf with pdf sdk.

Our website gives trial version of ByteScout PDF Suite for free. It also includes documentation and source code samples.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using Bytescout.PDF; using System; namespace RemovePdfProtection { class Program { static void Main(string[] args) { try { //Files string fileName = "ProtectedPDFFile.pdf"; string fileName_UnProtected = "UnProtectedPDFFile.pdf"; //Protected file password string filePassword = "admin@123"; //Process file to remove password using (Document document = new Document()) { document.RegistrationName = "demo"; document.RegistrationKey = "demo"; document.Load(fileName, filePassword); // Remove password protection and encryption document.Security.OwnerPassword = String.Empty; document.Security.UserPassword = String.Empty; document.Security.EncryptionAlgorithm = EncryptionAlgorithm.None; // Remove restrictions document.Security.AllowAccessibilitySupport = true; document.Security.AllowAssemlyDocument = true; document.Security.AllowContentExtraction = true; document.Security.AllowFillForms = true; document.Security.AllowModifyAnnotations = true; document.Security.AllowModifyDocument = true; document.Security.AllowPrintDocument = true; document.Security.PrintQuality = PrintQuality.HightResolution; //Save Unprotected file document.Save(fileName_UnProtected); } Console.WriteLine("PDF restrictions removed successfully!"); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine(); Console.WriteLine("Press any key to exit...."); Console.ReadLine(); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next