ByteScout PDF SDK - VBScript and VB6 - Set Graphics State for PDF - ByteScout

ByteScout PDF SDK – VBScript and VB6 – Set Graphics State for PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – VBScript and VB6 – Set Graphics State for PDF

How to set graphics state for PDF in VBScript and VB6 using ByteScout PDF SDK

This tutorial will show how to set graphics state for PDF in VBScript and VB6

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.

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

GraphicsState.vbs
      
' 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

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