PDFRasterizer.NET 4.0 is now available. Supports .NET Core. Renders pixel-perfectly.

Remove PDF security settings

Remove the security setting of a PDF

This code sample shows how you can remove the security setting of a PDF quite easily; just set the security attribute to null.

using (FileStream inFile = new FileStream("PackingLightBrochure.pdf", FileMode.Open, FileAccess.Read))
{
    // open the source document
    Document document = new Document( inFile );
         
    // remove security settings - as a consequence user privileges 
    // that were disabled are now enabled again
    document.Security = null;

    // write the modified document to disk
    using ( FileStream outFile = new FileStream("removesecuritysettings.pdf", FileMode.Create, FileAccess.Write ) )
    {
        document.Write( outFile );
    }
}

``` vb
Using inFile As New FileStream("PackingLightBrochure.pdf", FileMode.Open, FileAccess.Read)
    ' open the source document
    Dim document As New Document(inFile)

    ' remove security settings - as a consequence user privileges 
    ' that were disabled are now enabled again
    document.Security = Nothing

    ' write the modified document to disk
    Using outFile As New FileStream("removesecuritysettings.pdf", FileMode.Create, FileAccess.Write)
        document.Write(outFile)
    End Using
End Using
Download PDFKit.NET 5.0
We will send you a download link

  • This field is for validation purposes and should be left unchanged.
Why do we ask your email address?
We send tips that speed up your evaluation
We let you know about bug fixes
You can always unsubscribe with one click
We never share your address with a 3rd party
Thank you for your download

We have sent an email with a download link.