VB.NET PDF: How to HTML5 PDF Viewer PDF Create PDF Export File & Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF PDF Viewer Work with Other SDKs Barcode Read Barcode Create OCR Twain
Password: Set File Permissions
Home ›› XDoc.PDF ›› VB.NET PDF: Set File Permissions

VB.NET PDF - Set PDF File Permissions in VB.NET

VB.NET Tutorial for How to Set PDF File Access Permissions Using XDoc.PDF for VB.NET


In some case, document cannot be ignored on safety and copyright. RasterEdge XDoc.PDF SDK provides several functions to protect documents in VB.NET application. This tutorial will shows you how to use our .NET PDF SDK to set file permissions for your PDF document in Visual Basic project. In details, following aspects can be achieved.

Specify whether PDF document can be printed or not

PDF file printing with high-resolution is also supported

Determine whether to allow users to change PDF document

Choose to offer PDF annotation and content extraction functions

Enable or disable copying and form filling functions

Provide users with the ability of assembling PDF document

Set PDF File Access Permission Using VB.NET

Add necessary references:









Use corresponding namespaces;

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.PDF;

In the following code table, you will find a VB.NET code sample for how to set PDF file permissions stated above.

Dim inputFilePath As String = Program.RootPath + "\\" + "3.pdf"
Dim outputFilePath As String = Program.RootPath + "\\" + "3_pw_a.pdf"

' Create a password setting object with user password "Hello World".
Dim passwordSetting As PasswordSetting = New PasswordSetting("Hello World")

' Set encryption level to AES-128.
passwordSetting.Level = EncryptionLevel.AES_128bit

' Printing is allowed.
passwordSetting.IsPrint = True

' Print with high-resolution.
passwordSetting.IsHighReso = True

' Document is allowed to be changed.
passwordSetting.IsModify = True

' Annotation is allowed.
passwordSetting.IsAnnot = True

' Form filling is allowed.
passwordSetting.IsFillForm = True

' Content extraction is allowed.
passwordSetting.IsExtract = True

' Copying is allowed.
passwordSetting.IsCopy = True

' PDF document assembling is allowed.
passwordSetting.IsAssemble = True

' Add password to the file.
PDFDocument.AddPassword(inputFilePath, outputFilePath, passwordSetting)