XDoc.PDF
Features
Tech Specs
How-to VB.NET
Pricing
How to Start Convert PDF Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

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





Look for HTML5 PDF Editor?

EdgePDF: ASP.NET PDF Editor is the best HTML5 PDF Editor and ASP.NET PDF Viewer based on XDoc.PDF, JQuery, HTML5. It supports ASP.NET MVC and WebForms projects.


Overview



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:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Raster.dll


  RasterEdge.XDoc.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


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)