ByteScout PDF SDK - VBScript and VB6 - Set Passwords and Permissions of PDF file - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout PDF SDK – VBScript and VB6 – Set Passwords and Permissions of PDF file

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – VBScript and VB6 – Set Passwords and Permissions of PDF file

How to set passwords and permissions of PDF file in VBScript and VB6 using ByteScout PDF SDK

Write code in VBScript and VB6 to set passwords and permissions of PDF file with this step-by-step tutorial

The sample source code below will teach you how to set passwords and permissions of PDF file in VBScript and VB6. ByteScout PDF SDK: the pdf library that can create, update and modify PDF files. Supports text with fonts and style selections, layers, form fields, drawing lines and objects, automatic tables, images. Can be used to create and fill pdf forms. It can set passwords and permissions of PDF file in VBScript and VB6.

You will save a lot of time on writing and testing code as you may just take the VBScript and VB6 code from ByteScout PDF SDK for set passwords and permissions of PDF file below and use it in your application. Just copy and paste the code into your VBScript and VB6 application’s code and follow the instruction. Use of ByteScout PDF SDK in VBScript and VB6 is also explained in the documentation included along with the product.

Trial version of ByteScout PDF SDK is available for free. Source code samples are included to help you with your VBScript and VB6 app.

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

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

PasswordsAndPermissions.vbs
      
' 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. ' Create Bytescout.PDF.Document object Set pdfDocument = CreateObject("Bytescout.PDF.Document") pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" Set comHelpers = pdfDocument.ComHelpers ' Create document Set page1 = comHelpers.CreatePage(comHelpers.PAPERFORMAT_A4) pdfDocument.Pages.Add(page1) ' or load existing one: 'pdfDocument.Load "c:\test\some-document.pdf" ' Set document encryption algorythm pdfDocument.Security.EncryptionAlgorithm = comHelpers.ENCRYPTIONALGORITHM_RC4_40BIT ' Set various user permissions pdfDocument.Security.AllowPrintDocument = False pdfDocument.Security.AllowContentExtraction = False pdfDocument.Security.AllowModifyAnnotations = False pdfDocument.Security.PrintQuality = comHelpers.PRINTQUALITY_LOWRESOLUTION ' Set owner password pdfDocument.Security.OwnerPassword = "ownerpassword" ' Set user password pdfDocument.Security.UserPassword = "userpassword" ' Save protected document to file pdfDocument.Save("result.pdf") ' Open document in default PDF viewer app Set shell = CreateObject("WScript.Shell") shell.Run "result.pdf", 1, false

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