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#.

Try ByteScout PDF SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

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(); } } }

Try ByteScout PDF SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

VIDEO

ON-PREMISE VERSION INFORMATION

Get 60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Get ByteScout PDF SDK Free Training

WEB API

Get Your Free API Key

Explore Web API Documentation

Tutorials:

prev
next