This sample source code below will demonstrate you how to set graphics state for PDF in VBScript and VB6. Want to set graphics state for PDF in your VBScript and VB6 app? ByteScout PDF SDK is designed for it. ByteScout PDF SDK is 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.
This rich sample source code in VBScript and VB6 for ByteScout PDF SDK includes the number of functions and options you should do calling the API to set graphics state for PDF. In your VBScript and VB6 project or application you may simply copy & paste the code and then run your app! This basic programming language sample code for VBScript and VB6 will do the whole work for you to set graphics state for PDF.
Trial version of ByteScout PDF SDK can be downloaded for free from our website. It also includes source code samples for VBScript and VB6 and other programming languages.
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 save and restore the graphics state. ' 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 ' Keep current graphics state canvas.SaveGraphicsState() ' Transform coordinates and draw rectangle canvas.TranslateTransform 200, 200 canvas.RotateTransform 45 Set blueBrush = comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(0, 0, 255)) canvas.DrawRectangle_2 (blueBrush), 0, 0, 100, 100 ' Restore the state and draw the same rectangle canvas.RestoreGraphicsState() Set redBrush = comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(255, 0, 0)) canvas.DrawRectangle_2 (redBrush), 200, 200, 100, 100 ' 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 SDK Home Page
Explore ByteScout PDF SDK Documentation
Explore Samples
Sign Up for ByteScout PDF SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
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
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: