Click here to Skip to main content
15,350,730 members
Articles / Web Development / ASP.NET
Posted 4 Dec 2008


77 bookmarked

PDF Security Remover

Rate me:
Please Sign up or sign in to vote.
4.84/5 (37 votes)
4 Dec 2008CPOL1 min read
Remove security from PDF files.


This tool allows you to remove the "security" from a PDF File. It has not been widely tested, but has worked on any PDF file that was marked Secure that I was able to open without a password.

Why would you want to do this? Many secure PDF files are set so that you can not copy text from them or print them. This can be really frustrating at times, especially when you are studying the material and you want to put together a study sheet, or something to that effect.


A while back, I purchased an exam study guide, which came with a companion CD containing the book in PDF format. Unfortunately, the file was marked as secure, so when I tried to copy out the "Suggested Practices" section from each chapter, I was not able to, nor could I print any of the pieces. This led me to develop this very small application.

Using the code

The tool is very simple. I use the PDFSharp library to read in the original PDF. I then copy each page to a new PDF file and save it.

Private Sub Form1_Load(ByVal sender As System.Object, _
            ByVal e As System.EventArgs) Handles MyBase.Load
    'Show open file dialog box,
    'this is where you choose what file to load
    Dim ofd As New OpenFileDialog()
    'if you say OK, then continue
    If ofd.ShowDialog() <> Windows.Forms.DialogResult.OK Then
        Exit Sub
    End If

    'import document using PDFSharp
    Dim maindoc As PdfDocument = PdfReader.Open(ofd.OpenFile(), _

    'Create the Output Document as a new PDF Document
    Dim OutputDoc As PdfDocument = New PdfDocument()

    'Copy over pages from original document
    For Each page As PdfPage In maindoc.Pages

    'Show the Save File Dialog box
    Dim sfd As New SaveFileDialog()
    'if user clicks ok then continue, else dispose objects
    If sfd.ShowDialog() <> Windows.Forms.DialogResult.OK Then
        Exit Sub
    End If

    'save new document
    OutputDoc.Save(sfd.OpenFile(), True)
    'dispose of objects
    'close the form
End Sub

Points of interest

I thought it was funny how easy it was to do this. I expected something a little more complicated, though if it had been, I probably would have just given up on it.


  • Version 1.0 - Initial release.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer Wicks Development
United States United States
No Biography provided

Comments and Discussions

QuestionPDF Security Remover did not work for me. Pin
Member 153490316-Sep-21 11:39
MemberMember 153490316-Sep-21 11:39 
GeneralMy vote of 5 Pin
Member 831101021-Nov-16 19:34
MemberMember 831101021-Nov-16 19:34 
QuestionThank you, took 2 secons, commercial product said would take 5 days on i5 processor Pin
Member 831101021-Nov-16 19:34
MemberMember 831101021-Nov-16 19:34 
QuestionWhich dll reference did you used for this Project? Pin
Sid_Joshi28-Oct-15 23:51
professionalSid_Joshi28-Oct-15 23:51 
BugThe PDF Document is Protected with an encryption not supported by PDFsharp Pin
kalpesh28043-Oct-12 21:25
Memberkalpesh28043-Oct-12 21:25 
GeneralRe: The PDF Document is Protected with an encryption not supported by PDFsharp Pin
Patricker4-Oct-12 2:28
MemberPatricker4-Oct-12 2:28 
GeneralRe: The PDF Document is Protected with an encryption not supported by PDFsharp Pin
kalpesh280414-Oct-12 17:20
Memberkalpesh280414-Oct-12 17:20 
GeneralMy vote of 5 Pin
Manoj Kumar Choubey10-May-12 0:45
professionalManoj Kumar Choubey10-May-12 0:45 
GeneralInteresting Topic. Pin
Chris Meech24-Nov-10 2:57
MemberChris Meech24-Nov-10 2:57 
GeneralMy vote of 5 Pin
Global Analyser3-Nov-10 11:14
MemberGlobal Analyser3-Nov-10 11:14 
GeneralThanksssss Pin
gaandkaisshi3-Jun-09 22:10
Membergaandkaisshi3-Jun-09 22:10 
GeneralMy Vote of 5 Pin
thund3rstruck8-Jan-09 4:51
Memberthund3rstruck8-Jan-09 4:51 
GeneralProblem running executable Pin
Steve Erbach12-Dec-08 3:48
MemberSteve Erbach12-Dec-08 3:48 
GeneralRe: Problem running executable Pin
Patricker12-Dec-08 5:13
MemberPatricker12-Dec-08 5:13 
GeneralMy vote of 1 Pin
Giri Ganji8-Dec-08 19:00
MemberGiri Ganji8-Dec-08 19:00 
GeneralRe: My vote of 1 Pin
LloydA1113-Dec-10 2:45
MemberLloydA1113-Dec-10 2:45 
GeneralStrips bookmarks Pin
ccfoo2425-Dec-08 5:07
Memberccfoo2425-Dec-08 5:07 
GeneralRe: Strips bookmarks Pin
Patricker5-Dec-08 13:11
MemberPatricker5-Dec-08 13:11 
GeneralI think this tool is great. Pin
shogunz0r4-Dec-08 20:35
Membershogunz0r4-Dec-08 20:35 
GeneralCopyright violation Pin
haathi4-Dec-08 12:31
Memberhaathi4-Dec-08 12:31 
GeneralRe: Encouraging Copyrights Violation ? Pin
Patricker4-Dec-08 15:14
MemberPatricker4-Dec-08 15:14 
GeneralRe: Encouraging Copyrights Violation ? Pin
faulty4-Dec-08 21:04
Memberfaulty4-Dec-08 21:04 
This also help to show that how not useful is the anti copy feature. I think someone should improve on it instead of complaining on others to discover it. If no one discover it doesn't mean it's secure anyway. I would rather have white hat to discover and announce it than a black hat which "exploit" it.

Hiding something insecure doesn't make it any more secure than it already is.
GeneralMy vote of 1 Pin
haathi4-Dec-08 12:29
Memberhaathi4-Dec-08 12:29 
GeneralRe: My vote of 1 Pin
Matware11-Dec-08 17:33
MemberMatware11-Dec-08 17:33 
GeneralRe: My vote of 1 Pin
Tim Cabrera21-Jun-09 17:26
MemberTim Cabrera21-Jun-09 17:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.