ByteScout PDF SDK - VBScript and VB6 - Text - Watermarks - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout PDF SDK – VBScript and VB6 – Text – Watermarks

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

ByteScout PDF SDK – VBScript and VB6 – Text – Watermarks

Watermarks.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 pages
pdfDocument.Pages.Add(comHelpers.CreatePage(comHelpers.PAPERFORMAT_A4))
pdfDocument.Pages.Add(comHelpers.CreatePage(comHelpers.PAPERFORMAT_A4))
pdfDocument.Pages.Add(comHelpers.CreatePage(comHelpers.PAPERFORMAT_A4))

Set font1 = comHelpers.CreateSystemFont("Times New Roman", 16)
Set font2 = comHelpers.CreateStandardFont(comHelpers.STANDARDFONTS_HELVETICABOLD, 24)

Set semitransparentRedBrush = comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(255, 0, 0))
semitransparentRedBrush.Opacity = 50 ' make the brush semitransparent
Set greenBrush = comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(0, 128, 0))
Set semitransparentBlueBrush = comHelpers.CreateSolidBrush(comHelpers.CreateColorRGB(0, 0, 255))
semitransparentBlueBrush.Opacity = 50 ' make the brush semitransparent
Set redPen = comHelpers.CreateSolidPen(comHelpers.CreateColorRGB(255, 0, 0), 1)

' Add tiling watermark
Set watermark1 = comHelpers.CreateTextWatermark("Tiling Watermark")
watermark1.WatermarkLocation = comHelpers.TEXTWATERMARKLOCATION_TILED
watermark1.Angle = 30
watermark1.Brush = semitransparentBlueBrush
pdfDocument.Watermarks.Add(watermark1)

' Add autosized watermark to every page of the document
Set watermark2 = comHelpers.CreateTextWatermark("Center Watermark")
watermark2.WatermarkLocation = comHelpers.TEXTWATERMARKLOCATION_DIAGONALFROMBOTTOMLEFTTOTOPRIGHT
watermark2.Font = font1
watermark2.Brush = semitransparentRedBrush
watermark2.Pen = redPen
pdfDocument.Watermarks.Add(watermark2)

' Add watermark of custom size and location to the first page only
Set watermark3 = comHelpers.CreateTextWatermark("Simple Watermark")
watermark3.Font = font2
watermark3.Brush = greenBrush
watermark3.Left = 350
watermark3.Top = 800
pdfDocument.Pages.Item(0).Watermarks.Add(watermark3)

' 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