The sample source codes on this page shows how to add watermarks to PDF in VB.NET. Want to add watermarks to PDF in your VB.NET app? ByteScout PDF SDK is designed for it. ByteScout PDF SDK is the library 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.
The SDK samples like this one below explain how to quickly make your application do add watermarks to PDF in VB.NET with the help of ByteScout PDF SDK. Follow the instructions from the scratch to work and copy the VB.NET code. Enjoy writing a code with ready-to-use sample VB.NET codes.
ByteScout free trial version is available for download from our website. It includes all these programming tutorials along with source code samples.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
Imports Bytescout.PDF
''' <summary>
''' This example demonstrates how add text watermark to document page.
''' </summary>
Class Program
Shared Sub Main()
' Create new document
Dim pdfDocument = New Document()
pdfDocument.RegistrationName = "demo"
pdfDocument.RegistrationKey = "demo"
' Add pages
pdfDocument.Pages.Add(New Page(PaperFormat.A4))
pdfDocument.Pages.Add(New Page(PaperFormat.A4))
pdfDocument.Pages.Add(New Page(PaperFormat.A4))
' Add tiling watermark
Dim watermark1 = New TextWatermark("Tiling Watermark")
watermark1.WatermarkLocation = TextWatermarkLocation.Tiled
watermark1.Angle = 30
Dim brush1 = New SolidBrush(New ColorRGB(0, 0, 255))
brush1.Opacity = 50 ' make the brush semitransparent
watermark1.Brush = brush1
pdfDocument.Watermarks.Add(watermark1)
' Add autosized watermark to every page of the document
Dim watermark2 = New TextWatermark("Diagonal Watermark")
watermark2.WatermarkLocation = TextWatermarkLocation.DiagonalFromBottomLeftToTopRight
watermark2.Font = New Font("Times New Roman", 16)
Dim brush2 = New SolidBrush(New ColorRGB(255, 0, 0))
brush2.Opacity = 50 ' make the brush semitransparent
watermark2.Brush = brush2
watermark2.Pen = New SolidPen(New ColorRGB(255, 0, 0)) ' outline pen is optional
pdfDocument.Watermarks.Add(watermark2)
' Add watermark of custom size and location to the first page only
Dim watermark3 = New TextWatermark("Simple Watermark")
watermark3.Font = New Font(StandardFonts.HelveticaBold, 24)
watermark3.Brush = New SolidBrush(New ColorRGB(0, 128, 0))
watermark3.Left = 350
watermark3.Top = 800
pdfDocument.Pages(0).Watermarks.Add(watermark3)
' Save document to file
pdfDocument.Save("result.pdf")
' Cleanup
pdfDocument.Dispose()
' Open document in default PDF viewer app
Process.Start("result.pdf")
End Sub
End Class
60 Day Free Trial or Visit ByteScout PDF SDK Home Page
Explore ByteScout PDF SDK Documentation
Explore Samples
Sign Up for ByteScout PDF SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout PDF SDK Home Page
Explore ByteScout PDF SDK Documentation
Explore Samples
Sign Up for ByteScout PDF SDK Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: