ByteScout PDF SDK - C# - Remove Password and Protection From PDF - ByteScout

ByteScout PDF SDK – C# – Remove Password and Protection From PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – C# – Remove Password and Protection From PDF

How to remove password and protection from PDF in C# and ByteScout PDF SDK

This code in C# shows how to remove password and protection from PDF with this how to tutorial

Remove password and protection from PDF is easy to implement in C# if you use these source codes below. ByteScout PDF SDK is the component to help programmers in generating new pdf files, modifying and updating existing pdf documents or pdf forms. Provides support for auto-filling pdf forms, adding text with adjustable font, style, size, font family, new form fields, vector and raster drawings and you can use it to remove password and protection from PDF with C#.

You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout PDF SDK for remove password and protection from PDF below and use it in your application. Just copy and paste the code into your C# application’s code and follow the instruction. This basic programming language sample code for C# will do the whole work for you to remove password and protection from PDF.

Free trial version of ByteScout PDF SDK is available for download from our website. Get it to try other source code samples for C#.

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 SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK 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 SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next