Skip to footer content
PRODUCT COMPARISONS

Explore the Best Alternatives for PDFsharp Add Watermark to PDF

Adding watermarks to PDFs is a common requirement for document security, branding, and version control. Whether marking documents as confidential, branding official reports, or preventing unauthorized reproduction, watermarking is an essential feature.

In C#, developers have multiple libraries to choose from, with IronPDF and PDFSharp being two of the most popular options. However, their approaches, ease of use, performance, and licensing structures differ significantly. This article provides a detailed comparison between IronPDF and PDFsharp for adding watermarks to existing PDFs, offering insights into their functionalities, implementation processes, and customization capabilities.

The comparison covers both libraries’ watermarking APIs with working code examples, so you can assess which fits your project’s requirements.

Understanding PDF Watermarking

What is a Watermark?

A watermark is a graphical or textual overlay on a document that serves as an identifier, deterrent, or branding element. Watermarks can be visible or invisible, depending on their purpose, and are closely related to text and image stamps used for document annotation.

Types of Watermarks

  • Text Watermark – Typically a semi-transparent overlay with a message like "CONFIDENTIAL" or "DRAFT."
  • Image Watermark – A logo, emblem, or graphic embedded into the document.
  • Transparent Watermark – A subtle branding mark that doesn’t obstruct the document’s readability.
  • Stamped Watermark – A more prominent, bold marking that ensures visibility.

Common Use Cases

  • Security & Protection – Prevent unauthorized duplication by marking documents as proprietary.
  • Branding – Add company logos or signatures to maintain brand consistency across documents.
  • Version Control – Label drafts, final versions, or document revisions.

What Are IronPDF and PDFsharp?

IronPDF

IronPDF is a premium, feature-rich .NET library designed to streamline PDF handling, from creating PDFs from scratch to advanced manipulation tasks. It is especially useful for developers looking for easy implementation of PDF manipulation tasks, including watermarking.

Key Features:

  • Simple and intuitive API requiring minimal code.
  • Supports text and image watermarks with customization options.
  • Offers opacity control, positioning, and rotation for precise placement.
  • Compatible with .NET 6+, .NET Core, and .NET Framework.
  • Available with a perpetual licensing model for long-term use.
  • Additional capabilities include PDF annotations, HTML-to-PDF conversion, and digital signatures.

PDFsharp

PDFsharp is an open-source library that allows developers to create, edit, and manipulate PDFs in C#. If you are currently using PDFsharp and considering a switch, the PDFsharp to IronPDF migration guide walks through the transition process. It offers fine-grained control over drawing operations, though watermarking involves more manual implementation than IronPDF's abstracted approach.

Key Features:

  • Free and open-source, making it cost-effective for budget-conscious projects.
  • Provides low-level control over PDF drawing operations, including both outlined graphical paths and transparent graphical paths.
  • Supports both text and image watermarks but requires additional code for transformations.
  • Works with .NET Framework and .NET Core (via PDFSharpCore).
  • Does not include built-in high-level watermarking functions; developers implement features like opacity and rotation directly through the drawing API.

Here is a quick side-by-side summary of how the two libraries compare for watermarking tasks:

Feature IronPDF PDFsharp
Text Watermark Built-in ApplyWatermark method Manual drawing via XGraphics API
Image Watermark HTML/CSS <img> tag support DrawImage with manual positioning
Opacity Control Parameter on ApplyWatermark Requires custom brush/alpha handling
Rotation Parameter on ApplyWatermark Manual RotateTransform call
Watermark Styling Full HTML/CSS support Font and brush configuration
.NET Compatibility .NET 6+, Core, Framework .NET Framework, Core (via PDFSharpCore)
Licensing Commercial (perpetual option) Open-source (MIT)

IronPDF's free 30-day trial includes the full watermarking API used in the examples below.

Adding a Watermark with IronPDF

IronPDF provides a high-level API that enables developers to apply watermarks in just a few lines of code, without manual coordinate calculations or graphics pipeline setup. Because IronPDF's watermark tool accepts HTML/CSS strings — leveraging the same Chromium-based HTML rendering engine used across the library — you get full control over styling, positioning, and appearance using familiar web markup.

Text Watermark Example

using IronPdf;

const string filename = "existing.pdf";
// Load the existing PDF file
PdfDocument pdf = PdfDocument.FromFile(filename);

// Create a simple HTML-based watermark
string watermark = "<h1 style='color:red'>Confidential!</h1>";

// Apply the watermark to the PDF
pdf.ApplyWatermark(watermark);

// Save the updated document with the applied watermark
pdf.SaveAs("watermarked.pdf");
using IronPdf;

const string filename = "existing.pdf";
// Load the existing PDF file
PdfDocument pdf = PdfDocument.FromFile(filename);

// Create a simple HTML-based watermark
string watermark = "<h1 style='color:red'>Confidential!</h1>";

// Apply the watermark to the PDF
pdf.ApplyWatermark(watermark);

// Save the updated document with the applied watermark
pdf.SaveAs("watermarked.pdf");
$vbLabelText   $csharpLabel

Explore the Best Alternatives for PDFsharp Add Watermark to PDF: Figure 3 - Text watermark output

In this code example, we see just how easy it is to apply a watermark to your existing PDF files with IronPDF. Here, we load the existing PDF using the FromFile method. Then, we create a simple string formatted as an HTML element as the watermark and apply it to the PDF using ApplyWatermark, similar to how you would use HTML to create a PDF from scratch. As shown in the output image, this has added a simple text string "Confidential" as a watermark on our PDF.

Image Watermark Example

using IronPdf;

// Load the PDF document
PdfDocument pdf = PdfDocument.FromFile("existing.pdf");

// Create an HTML-based watermark containing the image
string watermark = "<img src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>";

// Apply the watermark to the PDF with rotation and opacity
pdf.ApplyWatermark(watermark, rotation: 45, opacity: 80);

// Save the watermarked document
pdf.SaveAs("watermarked.pdf");
using IronPdf;

// Load the PDF document
PdfDocument pdf = PdfDocument.FromFile("existing.pdf");

// Create an HTML-based watermark containing the image
string watermark = "<img src='https://ironsoftware.com/img/products/ironpdf-logo-text-dotnet.svg'>";

// Apply the watermark to the PDF with rotation and opacity
pdf.ApplyWatermark(watermark, rotation: 45, opacity: 80);

// Save the watermarked document
pdf.SaveAs("watermarked.pdf");
$vbLabelText   $csharpLabel

Explore the Best Alternatives for PDFsharp Add Watermark to PDF: Figure 4

Adding an image as a watermark is just as easy as adding text, as they both use the same method. Just like in the text example, we create a new watermark string variable containing the HTML image tag pointing to the image URL and apply it. This time, we include customized rotation and opacity transformations via IronPDF's rendering options parameters.

This approach overlays an image watermark at a specified position, allowing for custom placement and transparency.

Adding a Watermark with PDFsharp

PDFsharp requires developers to manually render text and images using its GDI+ drawing API. To watermark an existing PDF file, create an XGraphics object for drawing and apply the desired content.

Text Watermark Example

using PdfSharp.Pdf;
using PdfSharp.Drawing;
using PdfSharp.Pdf.IO;

const string filename = "existing.pdf";
// Open the PDF document in modify mode
var document = PdfReader.Open(filename, PdfDocumentOpenMode.Modify);

foreach (var page in document.Pages)
{
    // Create an XGraphics object for drawing
    var gfx = XGraphics.FromPdfPage(page);

    // Move the origin to the center of the page for rotation purposes
    gfx.TranslateTransform(page.Width / 2, page.Height / 2);

    // Rotate for diagonal watermark placement
    gfx.RotateTransform(Math.Atan(page.Height / page.Width));

    // Define font and brush for drawing the watermark text
    var font = new XFont("Arial", 40);
    var brush = new XSolidBrush(XColor.FromArgb(128, XColors.Red));  // Semi-transparent red

    // Draw the watermark text centered on the page
    gfx.DrawString("WATERMARK", font, brush, new XPoint(0, 0));
}

// Save modified document
document.Save("watermarked.pdf");
using PdfSharp.Pdf;
using PdfSharp.Drawing;
using PdfSharp.Pdf.IO;

const string filename = "existing.pdf";
// Open the PDF document in modify mode
var document = PdfReader.Open(filename, PdfDocumentOpenMode.Modify);

foreach (var page in document.Pages)
{
    // Create an XGraphics object for drawing
    var gfx = XGraphics.FromPdfPage(page);

    // Move the origin to the center of the page for rotation purposes
    gfx.TranslateTransform(page.Width / 2, page.Height / 2);

    // Rotate for diagonal watermark placement
    gfx.RotateTransform(Math.Atan(page.Height / page.Width));

    // Define font and brush for drawing the watermark text
    var font = new XFont("Arial", 40);
    var brush = new XSolidBrush(XColor.FromArgb(128, XColors.Red));  // Semi-transparent red

    // Draw the watermark text centered on the page
    gfx.DrawString("WATERMARK", font, brush, new XPoint(0, 0));
}

// Save modified document
document.Save("watermarked.pdf");
$vbLabelText   $csharpLabel

This implementation draws a watermark on each page through explicit coordinate-based positioning. While it produces a similar output to the IronPDF example, PDFsharp's approach involves more code — IronPDF's text watermark requires roughly 4 active lines versus PDFsharp's 10, since PDFsharp delegates layout decisions (translation, rotation, font selection) to the developer rather than abstracting them.

Image Watermark Example

using PdfSharp.Pdf;
using PdfSharp.Drawing;
using PdfSharp.Pdf.IO;

// Open the existing PDF document in modify mode
var document = PdfReader.Open("sample.pdf", PdfDocumentOpenMode.Modify);

// Load the watermark image
XImage watermark = XImage.FromFile("watermark.png");

foreach (var page in document.Pages)
{
    // Create a graphics object from the page
    XGraphics gfx = XGraphics.FromPdfPage(page);

    // Draw the image watermark at the specified position and size
    gfx.DrawImage(watermark, 50, 100, watermark.PixelWidth / 2, watermark.PixelHeight / 2);
}

// Save the modified PDF document
document.Save("watermarked.pdf");
using PdfSharp.Pdf;
using PdfSharp.Drawing;
using PdfSharp.Pdf.IO;

// Open the existing PDF document in modify mode
var document = PdfReader.Open("sample.pdf", PdfDocumentOpenMode.Modify);

// Load the watermark image
XImage watermark = XImage.FromFile("watermark.png");

foreach (var page in document.Pages)
{
    // Create a graphics object from the page
    XGraphics gfx = XGraphics.FromPdfPage(page);

    // Draw the image watermark at the specified position and size
    gfx.DrawImage(watermark, 50, 100, watermark.PixelWidth / 2, watermark.PixelHeight / 2);
}

// Save the modified PDF document
document.Save("watermarked.pdf");
$vbLabelText   $csharpLabel

Explore the Best Alternatives for PDFsharp Add Watermark to PDF: Figure 6

This method places an image watermark at a fixed position and size. Opacity handling is outside PDFsharp's single-call API surface — developers who need transparency control manage it through the XGraphics pipeline directly. As with the text watermark example, PDFsharp gives you granular control over rendering at the cost of additional setup compared to IronPDF's higher-level watermarking API.

How Do IronPDF and PDFsharp Compare for Watermarking?

Ease of Use

  • IronPDF: Provides high-level functions that simplify watermarking with minimal code. It abstracts complex operations, making it ideal for developers who need a quick and efficient solution.
  • PDFSharp: Requires manual implementation using the graphics API, which increases complexity and development time. It is better suited for developers who need fine-grained control over rendering but are comfortable with additional coding.

Performance

  • IronPDF: Ships as a single NuGet package with watermark operations that handle opacity, rotation, and positioning in one method call, reducing per-page processing overhead when watermarking multi-page documents. For large-scale workflows, see the IronPDF performance optimization guide.
  • PDFSharp: Lightweight with a small dependency footprint. For complex watermarking tasks involving multiple transformations per page, developers may need to profile and optimize their drawing logic, since PDFsharp does not batch or cache these operations internally.

Customization Options

  • IronPDF: Built-in support for opacity, rotation, positioning, and font size customization. Users can easily tweak settings without delving into complex rendering logic.
  • PDFSharp: Requires additional coding for opacity, transparency effects, and transformation handling. While powerful, it demands a higher level of customization from the developer, including using the var format for specific rendering tasks.

Compatibility

  • IronPDF: Fully compatible with .NET 6+, .NET Core, and .NET Framework, making it suitable for modern and legacy applications.
  • PDFSharp: Supports .NET Framework and .NET Core (via PDFSharpCore). Some newer framework features may be outside its current scope, depending on the community port you select.

Licensing and Cost

  • IronPDF: A commercial product that requires a paid license but includes perpetual licensing options, customer support, and continuous updates.
  • PDFSharp: Open-source and free to use, making it a cost-effective solution for developers who prefer an unrestricted licensing model but are willing to handle their own support and updates.

Beyond license cost, total project cost includes the developer hours spent on manual coordinate-based positioning, custom opacity and rotation logic, and per-page drawing code that IronPDF handles in a single method call. For teams evaluating cost over a multi-year project lifecycle, these implementation and maintenance hours frequently eclipse the difference between open-source and commercial licensing.

Which Library Should You Choose?

Explore the Best Alternatives for PDFsharp Add Watermark to PDF: Figure 7

PDFsharp provides solid low-level drawing control and an open-source license — a genuine advantage for teams with tight budgets and the development capacity to build watermarking logic from scratch. For teams that need built-in watermark positioning, opacity, rotation, and HTML/CSS-based styling as first-class operations, IronPDF offers a more comprehensive API that reduces implementation time. Ultimately, the best choice depends on your project requirements, coding expertise, and available resources.

Try IronPDF out for yourself by downloading the free trial and exploring how it can take your C# PDF projects to the next level today!

Please notePDFsharp is a registered trademark of its respective owner. This site is not affiliated with, endorsed by, or sponsored by PDFsharp. All product names, logos, and brands are property of their respective owners. Comparisons are for informational purposes only and reflect publicly available information at the time of writing.

Frequently Asked Questions

How can I add a watermark to a PDF using a .NET library?

You can add a watermark to a PDF using IronPDF by utilizing its simple API, which supports both text and image watermarks with customizable options like opacity and rotation.

What are the advantages of using a premium .NET PDF library for watermarking?

A premium .NET PDF library like IronPDF offers high-level functions for easy watermarking, compatibility with modern .NET frameworks, and additional features like PDF annotations and HTML-to-PDF conversion.

Why is watermarking important in PDF documents?

Watermarking is important for document security, branding, and version control. It helps prevent unauthorized reproduction, ensures brand consistency, and marks documents as confidential.

What are the differences between IronPDF and PDFsharp in watermarking PDFs?

IronPDF provides a more intuitive API for easy watermarking with minimal code, while PDFsharp requires more manual effort and additional coding for transformations and opacity settings.

How does IronPDF improve PDF manipulation compared to open-source options?

IronPDF offers built-in high-level functions, making it easier to perform PDF manipulations like watermarking, annotations, and conversions, which would require more complex coding in open-source options like PDFsharp.

What types of watermarks can be added to PDFs using .NET libraries?

With libraries like IronPDF, you can add text watermarks, image watermarks, and transparent watermarks, with options for customization regarding positioning, opacity, and rotation.

Is IronPDF suitable for handling large PDF documents?

Yes, IronPDF is optimized for high-speed processing and can efficiently handle large PDF documents without performance issues.

What should I consider when choosing between a premium and open-source .NET PDF library?

Consider ease of use, available features, compatibility, performance, and support. A premium library like IronPDF offers extensive features and support, whereas an open-source library like PDFsharp is free but requires more complex coding and lacks official support.

Can I use IronPDF with .NET Core?

Yes, IronPDF is compatible with .NET 6+, .NET Core, and .NET Framework, making it versatile for different development environments.

What additional functionalities does IronPDF provide beyond watermarking?

In addition to watermarking, IronPDF supports PDF annotations, HTML-to-PDF conversion, digital signatures, and more, offering comprehensive PDF manipulation capabilities.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me