Link Search Menu Expand Document

Set Show and Hide Widget in PDF - VBScript and VB6

PDF SDK sample in VBScript and VB6 demonstrating ‘Set Show and Hide Widget in PDF’

' This example demonstrates how to show/hide a widget in document.

' Create Bytescout.PDF.Document object
Set pdfDocument = CreateObject("Bytescout.PDF.Document")
pdfDocument.RegistrationName = "demo"
pdfDocument.RegistrationKey = "demo"

' If you wish to load an existing document uncomment the line below And comment the Add page section instead
' pdfDocument.Load("existing_document.pdf")

Set comHelpers = pdfDocument.ComHelpers

' Add page
Set page1 = comHelpers.CreatePage(comHelpers.PAPERFORMAT_A4)

' Create widget that will be shown/hidden
Set editBox1 = comHelpers.CreateEditBox(20, 20, 100, 25, "editBox1")
editBox1.Text = "editBox1"

' Create button that will show the widget
Set buttonShow = comHelpers.CreatePushButton(20, 80, 50, 25, "buttonShow")
buttonShow.Caption = "Show"
' Add Show action
Set showAction = comHelpers.CreateHideAction(False)
buttonShow.OnActivated = showAction

' Create button that will hide the widget
Set buttonHide = comHelpers.CreatePushButton(100, 80, 50, 25, "buttonHide")
buttonHide.Caption = "Hide"
' Add Hide action
Set hideAction = comHelpers.CreateHideAction(True)
buttonHide.OnActivated = hideAction

' Save document to file

' Open document in default PDF viewer app
Set shell = CreateObject("WScript.Shell")
shell.Run "result.pdf", 1, false

Download Source Code (.zip)

Return to the previous page Explore PDF SDK