ByteScout PDF SDK - VBScript and VB6 - Draw Rectangles in PDF - ByteScout

ByteScout PDF SDK – VBScript and VB6 – Draw Rectangles in PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – VBScript and VB6 – Draw Rectangles in PDF

How to draw rectangles in PDF in VBScript and VB6 and ByteScout PDF SDK

This code in VBScript and VB6 shows how to draw rectangles in PDF with this how to tutorial

Draw rectangles in PDF is easy to implement in VBScript and VB6 if you use these source codes below. ByteScout PDF SDK can draw rectangles in PDF. It can be used from VBScript and VB6. ByteScout PDF SDK is the component to help programmers in generating new pdf files, modifying and updating existing pdf documents or pdf forms. Provides support for auto-filling pdf forms, adding text with adjustable font, style, size, font family, new form fields, vector and raster drawings.

This code snippet below for ByteScout PDF SDK works best when you need to quickly draw rectangles in PDF in your VBScript and VB6 application. Just copy and paste the code into your VBScript and VB6 application’s code and follow the instruction. Implementing VBScript and VB6 application typically includes multiple stages of the software development so even if the functionality works please test it with your data and the production environment.

Free trial version of ByteScout PDF SDK is available on our website. Documentation and source code samples are included.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Rectangles.vbs
      
' This example demonstrates how to draw rectangles. ' 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 ' Prepare pens and brushes Set borderPen = comHelpers.CreateSolidPen(comHelpers.CreateColorGray(128), 2.0) Set brush1 = comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(255, 0, 0)) Set brush2 = comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(0, 255, 255)) ' Draw transparent rectangle with border only canvas.DrawRectangle (borderPen), 100, 100, 100, 50 ' Draw rounded rectangle with broder and filling canvas.DrawRoundedRectangle_3 (borderPen), (brush1), 250, 100, 100, 50, 10 ' Draw rectangle as polygon Set pointsArray = comHelpers.CreatePointsArray(Array(Array(400, 100), Array(500, 100), Array(500, 150), Array(400, 150))) canvas.DrawPolygon_3 (borderPen), (brush2), (pointsArray) ' 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

ON-PREMISE OFFLINE SDK

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

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

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

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next