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

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.

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

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

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

VIDEO

ON-PREMISE VERSION INFORMATION

Get 60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Get ByteScout PDF SDK Free Training

WEB API

Get Your Free API Key

Explore Web API Documentation

Tutorials:

prev
next