Aspose.PDF  for .NET

How to add watermark to PDF file in C#

Build your own .NET apps to watermarking PDF files using server-side APIs.

How to Watermark PDF File Using C#

In order to add watermark PDF file, we’ll use Aspose.PDF for .NET API which is a feature-rich, powerful and easy to use document manipulation API for C# platform. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.


PM> Install-Package Aspose.PDF

Steps to Add Watermark to PDF via C#

You need the aspose.pdf.dll to try the following workflow in your own environment.

  • Load PDF file with an instance of Document
  • Create an instance of WatermarkArtifact
  • Set properties of WatermarkArtifact object
  • Add watermark using method Add of Aspose.Pdf.Page.Artifacts collection class
  • Save PDF file

System Requirements

Aspose.PDF for .NET is supported on all major operating systems. Just make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with .NET Framework, .NET Core, and PHP, VBScript, Delphi, C++ via COM Interop.
  • Development environment like Microsoft Visual Studio.
  • Aspose.PDF for .NET referenced in your project.

Add Watermark to PDF - C#

    Document document = new Document(_dataDir + "text.pdf");
    WatermarkArtifact artifact = new WatermarkArtifact();
        new TextState()
            FontSize = 72,
            ForegroundColor = Color.Blue,
            Font = FontRepository.FindFont("Courier")
    artifact.ArtifactHorizontalAlignment = HorizontalAlignment.Center;
    artifact.ArtifactVerticalAlignment = VerticalAlignment.Center;
    artifact.Rotation = 45;
    artifact.Opacity = 0.5;
    artifact.IsBackground = true;
    document.Save(_dataDir + "watermark.pdf");
  • About Aspose.PDF for .NET API

    Aspose.PDF API can be used for PDF document manipulation and parsing within applications. One can create, modify, compress, secure, print or save PDF to TXT, HTML, PCL, XFA, XML, XPS, EPUB, TEX, Images and more formats. Aspose.PDF is a standalone API and it does not depend on any software including Adobe Acrobat.

    Watermark PDF via Online App

    Add watermark to PDF documents by visiting our Live Demos website. The live demo has the following benefits

      No need to download or setup anything
      No need to write any code
      Just upload your PDF file, set your watermark and hit "Add" button
      Instantly get the download link for the resultant file

    PDF What is PDF File Format

    Portable Document Format (PDF) is a type of document created by Adobe back in 1990s. The purpose of this file format was to introduce a standard for representation of documents and other reference material in a format that is independent of application software, hardware as well as Operating System. The PDF file format has full capability to contain information like text, images, hyperlinks, form-fields, rich media, digital signatures, attachments, metadata, Geospatial features and 3D objects in it that can become as part of source document.

    Read More