ByteScout PDF Suite - VBScript - Add watermarks in pdf with pdf sdk - ByteScout

ByteScout PDF Suite – VBScript – Add watermarks in pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – VBScript – Add watermarks in pdf with pdf sdk

How to add watermarks in pdf with pdf sdk in VBScript using ByteScout PDF Suite

Learn to code in VBScript to add watermarks in pdf with pdf sdk with this step-by-step tutorial

Every ByteScout tool includes simple example VBScript source codes that you can get here or in the folder with installed ByteScout product. ByteScout PDF Suite is the set that includes 6 SDK products to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript. It can add watermarks in pdf with pdf sdk in VBScript.

These VBScript code samples for VBScript guide developers to speed up coding of the application when using ByteScout PDF Suite. IF you want to implement the functionality, just copy and paste this code for VBScript below into your code editor with your app, compile and run your application. Want to see how it works with your data then code testing will allow the function to be tested and work properly.

The trial version of ByteScout PDF Suite can be downloaded for free from our website. It also includes source code samples for VBScript and other programming languages.

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

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

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

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite 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 Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next