WordSpacing.vbs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | ' 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
also available as: