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

PDFKit.NET 4.0
Create and manipulate PDF documents. Split, append, stamp, encrypt, extract, fill and more.
Single assembly
Convert PDF to JPG PNG
Convert to multi-page TIFF
Print PDF unattended

PDFKit.NET 5.0
Create and manipulate PDF documents. Split, append, stamp, encrypt, extract, fill and more.
Single assembly
Convert PDF to JPG PNG
Convert to multi-page TIFF
Print PDF unattended