ByteScout Premium Suite - C# - Add watermarks to pdf with pdf sdk - 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 Premium Suite – C# – Add watermarks to pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Premium Suite – C# – Add watermarks to pdf with pdf sdk

How to add watermarks to pdf with pdf sdk in C# with ByteScout Premium Suite

If you want to learn more then this tutorial will show how to add watermarks to pdf with pdf sdk in C#

These sample source codes on this page below are displaying how to add watermarks to pdf with pdf sdk in C#. What is ByteScout Premium Suite? It is the bundle that includes twelve SDK products from ByteScout including tools and components for PDF, barcodes, spreadsheets, screen video recording. It can help you to add watermarks to pdf with pdf sdk in your C# application.

Want to quickly learn? This fast application programming interfaces of ByteScout Premium Suite for C# plus the guidelines and the code below will help you quickly learn how to add watermarks to pdf with pdf sdk. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Check C# sample code samples to see if they respond to your needs and requirements for the project.

You can download free trial version of ByteScout Premium Suite from our website with this and other source code samples for C#.

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

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

Program.cs
      
using System.Diagnostics; using Bytescout.PDF; namespace Watermarks { /// <summary> /// This example demonstrates how add text watermark to document page. /// </summary> class Program { static void Main() { // Create new document Document 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 TextWatermark watermark1 = new TextWatermark("Tiling Watermark"); watermark1.WatermarkLocation = TextWatermarkLocation.Tiled; watermark1.Angle = 30; SolidBrush 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 TextWatermark watermark2 = new TextWatermark("Diagonal Watermark"); watermark2.WatermarkLocation = TextWatermarkLocation.DiagonalFromBottomLeftToTopRight; watermark2.Font = new Font("Times New Roman", 16); SolidBrush 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 TextWatermark 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 result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Premium Suite Home Page

Explore ByteScout Premium Suite Documentation

Explore Samples

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

Explore ByteScout Premium Suite Documentation

Explore Samples

Sign Up for ByteScout Premium Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next