ByteScout PDF Suite - VB.NET - Add watermarks to pdf with pdf sdk - ByteScout

ByteScout PDF Suite – VB.NET – Add watermarks to pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – VB.NET – Add watermarks to pdf with pdf sdk

How to add watermarks to pdf with pdf sdk in VB.NET and ByteScout PDF Suite

Learn to add watermarks to pdf with pdf sdk in VB.NET

Every ByteScout tool includes simple example VB.NET source codes that you can get here or in the folder with installed ByteScout product. ByteScout PDF Suite is the bundle that provides six different SDK libraries 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 be applied to add watermarks to pdf with pdf sdk using VB.NET.

Want to save time? You will save a lot of time on writing and testing code as you may just take the VB.NET code from ByteScout PDF Suite for add watermarks to pdf with pdf sdk below and use it in your application. IF you want to implement the functionality, just copy and paste this code for VB.NET below into your code editor with your app, compile and run your application. Complete and detailed tutorials and documentation are available along with installed ByteScout PDF Suite if you’d like to learn more about the topic and the details of the API.

ByteScout provides the free trial version of ByteScout PDF Suite along with the documentation and 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)

Program.vb
      
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

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