PDF VB.NET Library
How to Set PDF File Permissions in VB.NET
VB.NET Tutorial for How to Set PDF File Access Permissions Using XDoc.PDF for VB.NET
- 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
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.
Set PDF File Access Permission Using VB.NET
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)
|