These sample source codes on this page below are demonstrating how to draw lines and curves in PDF in VBScript and VB6. ByteScout PDF SDK is the SDK for pdf documents generation, modification and updates. Can also generate and fill PDF forms. Provides support for text (fonts, style, size, font family), layers, pdf form fields, vector and raster drawings and you can use it to draw lines and curves in PDF with VBScript and VB6.
You will save a lot of time on writing and testing code as you may just take the VBScript and VB6 code from ByteScout PDF SDK for draw lines and curves in PDF below and use it in your application. Follow the instructions from the scratch to work and copy the VBScript and VB6 code. This basic programming language sample code for VBScript and VB6 will do the whole work for you to draw lines and curves in PDF.
Free trial version of ByteScout PDF SDK is available on our website. Documentation and source code samples are included.
' This example demonstrates how to draw lines and curves. ' 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 Set blackPen = comHelpers.CreateSolidPen(comHelpers.CreateColorGray(0), 1) Set dashedPen = comHelpers.CreateSolidPen(comHelpers.CreateColorGray(0), 1) dashedPen.DashPattern = comHelpers.CreateDashPattern(Array(2.0, 2.0), 0) ' Draw dashed lines canvas.DrawLine (dashedPen), 100, 100, 200, 100 canvas.DrawLine (dashedPen), 200, 100, 200, 200 canvas.DrawLine (dashedPen), 200, 200, 100, 200 ' Draw besier curve by the same points canvas.DrawCurve (blackPen), 100, 100, 200, 100, 200, 200, 100, 200 ' 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