ByteScout PDF SDK - VB.NET - Set Passwords and Permissions for PDF - ByteScout

ByteScout PDF SDK – VB.NET – Set Passwords and Permissions for PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – VB.NET – Set Passwords and Permissions for PDF

How to set passwords and permissions for PDF in VB.NET and ByteScout PDF SDK

Write code in VB.NET to set passwords and permissions for PDF with this step-by-step tutorial

The code below will help you to implement an VB.NET app to set passwords and permissions for PDF. ByteScout PDF SDK is the library for pdf documents generation, modification and updates. Can also generate and fill PDF forms. Provides support for text (fonts, style, size, font family), layers, pdf form fields, vector and raster drawings. It can be used to set passwords and permissions for PDF using VB.NET.

This rich sample source code in VB.NET for ByteScout PDF SDK includes the number of functions and options you should do calling the API to set passwords and permissions for PDF. Follow the instructions from the scratch to work and copy the VB.NET code. Enjoy writing a code with ready-to-use sample VB.NET codes.

Download free trial version of ByteScout PDF SDK from our website with this and other source code samples for VB.NET.

Try ByteScout PDF SDK today: Get 60 Day Free Trial or sign up for Web API

Program.vb
      
Imports Bytescout.PDF ''' <summary> ''' This example demonstrates how to lock the document with a password. ''' PDF format supports two kinds of passwords: owner and user password. ''' User password allows to view document and perform allowed actions. ''' Owner password allows everything, including changing passwords and permissions. ''' </summary> Class Program Shared Sub Main() ' Create new document Dim pdfDocument = New Document() pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" ' Add page pdfDocument.Pages.Add(New Page(PaperFormat.A4)) ' Set document encryption algorythm pdfDocument.Security.EncryptionAlgorithm = EncryptionAlgorithm.RC4_40bit ' Set various user permissions pdfDocument.Security.AllowPrintDocument = False pdfDocument.Security.AllowContentExtraction = False pdfDocument.Security.AllowModifyAnnotations = False pdfDocument.Security.PrintQuality = PrintQuality.LowResolution ' Set owner password pdfDocument.Security.OwnerPassword = "ownerpassword" ' Set user password pdfDocument.Security.UserPassword = "userpassword" ' Save document to file pdfDocument.Save("result.pdf") ' Cleanup pdfDocument.Dispose() ' Open document in default PDF viewer app Process.Start("result.pdf") End Sub End Class

Try ByteScout PDF SDK today: 60 Day Free Trial (on-premise version) or sign up for Web API (on demand version)

VIDEO

ON-PREMISE VERSION

Get 60 Day Free Trial or Visit ByteScout PDF SDK page

Explore ByteScout PDF SDK documentation

WEB API

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next