ByteScout PDF SDK - VBScript and VB6 - Text - Word Spacing - ByteScout

ByteScout PDF SDK – VBScript and VB6 – Text – Word Spacing

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – VBScript and VB6 – Text – Word Spacing

ByteScout PDF SDK – VBScript and VB6 – Text – Word Spacing

WordSpacing.vbs

' This example demonstrates how to change the word spacing.

' 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 font = comHelpers.CreateSystemFont("Arial", 16)
Set brush = comHelpers.CreateSolidBrush(comHelpers.CreateColorGray(0))
Set stringFormat = comHelpers.CreateStringFormat()

' Standard word spacing
stringFormat.WordSpacing = 0.0
canvas.DrawString_4 "Standard word spacing 0.0", (font), (brush), 20, 20, (stringFormat)

' Increased word spacing
stringFormat.WordSpacing = 5.0
canvas.DrawString_4 "Increased word spacing 5.0", (font), (brush), 20, 50, (stringFormat)

' Reduced word spacing
stringFormat.WordSpacing = -2.5
canvas.DrawString_4 "Reduced word spacing -2.5", (font), (brush), 20, 80, (stringFormat)

' 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


  Click here to get your Free Trial version of the SDK

Tutorials:

prev
next