We made thousands of pre-made source code pieces for easy implementation in your own programming projects. ByteScout PDF Suite is the bundle that provides six different SDK libraries to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript and you can use it to use layers in pdf with pdf sdk with VBScript.
Want to quickly learn? This fast application programming interfaces of ByteScout PDF Suite for VBScript plus the guidelines and the code below will help you quickly learn how to use layers in pdf with pdf sdk. Simply copy and paste in your VBScript project or application you and then run your app! Complete and detailed tutorials and documentation are available along with installed ByteScout PDF Suite if you’d like to learn more about the topic and the details of the API.
You can download free trial version of ByteScout PDF Suite from our website to see and try many others source code samples for VBScript.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
' This example demonstrates how to add layers with optional content. ' Create Bytescout.PDF.Document object Set pdfDocument = CreateObject("Bytescout.PDF.Document") pdfDocument.RegistrationName = "demo" pdfDocument.RegistrationKey = "demo" Set comHelpers = pdfDocument.ComHelpers ' Add page Set page1 = comHelpers.CreatePage(comHelpers.PAPERFORMAT_A4) pdfDocument.Pages.Add(page1) Set canvas = page1.Canvas ' Add main layer Set allContents = comHelpers.CreateLayer("Main Layer") canvas.BeginMarkedContent(allContents) ' Add sub-layer Set layer1 = comHelpers.CreateLayer("Square") canvas.BeginMarkedContent(layer1) canvas.DrawRectangle_2 comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(0, 255, 0)), 20, 20, 100, 100 canvas.EndMarkedContent() ' Add second sub-layer Set layer2 = comHelpers.CreateLayer("Circle") canvas.BeginMarkedContent(layer2) canvas.DrawCircle_2 comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(255, 0, 0)), 70, 180, 50 canvas.EndMarkedContent() ' Add third sub-layer Set layer3 = comHelpers.CreateLayer("Triangle") canvas.BeginMarkedContent(layer3) Set pointsArray = comHelpers.CreatePointsArray(Array(Array(20, 340), Array(70, 240), Array(120, 340))) canvas.DrawPolygon_2 comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(0, 0, 255)), (pointsArray) canvas.EndMarkedContent() canvas.EndMarkedContent() pdfDocument.OptionalContents.Layers.Add(layer1) pdfDocument.OptionalContents.Layers.Add(layer2) pdfDocument.OptionalContents.Layers.Add(layer3) pdfDocument.OptionalContents.Layers.Add(allContents) ' Configure layers ' Group sub-layers Set group = comHelpers.CreateOptionalContentGroup() group.Add(comHelpers.CreateOptionalContentGroupLayer((layer1))) group.Add(comHelpers.CreateOptionalContentGroupLayer((layer2))) group.Add(comHelpers.CreateOptionalContentGroupLayer((layer3))) ' Order sub-layers pdfDocument.OptionalContents.Configuration.Order.Add(comHelpers.CreateOptionalContentGroupLayer((allContents))) pdfDocument.OptionalContents.Configuration.Order.Add(group) ' Make the third layer invisible by default (for example) pdfDocument.OptionalContents.Configuration.OFF.Add(layer3) ' Force the PDF viewer to show the layers panel initially pdfDocument.PageMode = comHelpers.PAGEMODE_OPTIONALCONTENT ' Save 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
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: