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.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

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

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next