Watermark documents using SharePoint Designer workflows

Designer workflow

In this guide, you’ll learn how to add watermarks to documents using SharePoint Designer workflows. These powerful workflow actions enable you to apply various elements such as text, rectangles, images, PDF files, QR codes, barcodes, and other shapes to a wide range of documents, either as overlays, or behind the document’s content.

Each watermark workflow action is applied to the document individually. For applying multiple watermarks simultaneously, the Composite Watermark feature offers an efficient solution.

You can seamlessly add barcodes to Microsoft Word, Excel, PowerPoint, and PDF files using SharePoint Designer workflows. Our solution supports a wide range of popular barcode types, including:

  • Codabar
  • Code11
  • Code32
  • Code39
  • Code39Extended
  • Code128 (A, B, C)
  • GS1Code128
  • Code93
  • Code93Extended

Adding barcodes to documents has many practical applications, particularly in document management. When documents leave the systems they’re created and stored in, barcodes help track, audit, and manage them effectively, ensuring document integrity and providing valuable auditing information through watermarks.

The individual workflow actions are self-explanatory, but the following elements warrant special attention:

  1. this document — Specifies the document to apply the watermark to. In most workflows, selecting Current Item is sufficient, but certain scenarios may require referencing a different item. Ensure the document’s file type, such as PDF, DOCX, XLSX, or PPTX, is supported.

  2. this file — Defines the name and location of the watermarked file. Leave this field blank to overwrite the original file with the watermarked version. Alternatively, specify a path (including the Document Library and folder name) to save the watermarked file in a separate location, e.g. shared documents/watermarked files/confidential.pdf.

  3. List ID — The ID of the list where the watermarked file is saved. This can be used later in the workflow to perform additional operations on the file, such as check in or checkout.

  4. Item ID — The ID of the watermarked file, which can be used in conjunction with the List ID for additional workflow tasks.

Text watermark

The text watermark workflow action enables you to add text to the foreground or background of one or more pages in a document, offering complete control over font, style, size, and color.

In SharePoint Designer, this workflow action is called Add Text watermark to Document, and it includes the following parameters.

The text stored in the content field can include embedded field codes, such as the date or current page number. Additionally, Microsoft SharePoint Designer lookup variables are supported, allowing dynamic information stored in workflow variables or item columns to be seamlessly embedded in the watermark.

RTF watermark

The Rich Text Format (RTF) watermark feature enables adding simple RTF-encoded text as a watermark, offering enhanced control over the appearance of individual words in the watermark. While this provides greater customization, it comes with added complexity.

An example of valid RTF is as follows:

{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard
This is some {\b bold} text.\par
}

In SharePoint Designer, this workflow action is called Add RTF watermark to Document, and it includes the following parameters.

Unlike the text watermark, the RTF watermark doesn’t support embedded field codes. However, Microsoft SharePoint Designer lookup variables are fully supported, allowing dynamic information stored in workflow variables or the item columns to be embedded in the watermark. When applied to Microsoft PowerPoint files, RTF watermarks are displayed as plain text.

Image watermark

Use the image watermark to add common image types (BMP, JPG, GIF, PNG, TIFF, WMF, EMF/EMF+) as a watermark to a document.

In SharePoint Designer, this workflow action is called Add Image watermark to Document and the parameters are as follows.

The image at this path parameter requires the full path of the image relative to the current site — for example, shared documents/images/company_logo.gif.

PDF watermark

You can use existing PDF files as watermarks in your documents. These files can be either dynamically generated (e.g. a Microsoft Word document converted to PDF using Nutrient Document Converter) or static PDF files created manually.

The Microsoft SharePoint Designer workflow action for this is named Add PDF Watermark to Document, and its parameters are as follows.

The PDF file path parameter requires the full path of the PDF relative to the current site — for instance, shared documents/static watermarks/company_logo.pdf.

PDF-based watermarks can only be applied to other PDF documents. It isn’t possible to use a PDF watermark on Office file formats like Word, Excel, or PowerPoint.

Rectangle watermark

Add a simple rectangle as a watermark to your document using the Add Rectangle to Document workflow action. This option allows you to define the size, position, and appearance of the rectangle. The parameters are as follows.

Line watermark

Use the Add Line to Document workflow action to add a line as a watermark. This is ideal for creating dividing elements or emphasizing specific sections within a document. The parameters are as follows.

Ellipse watermark

Easily add a circle or ellipse as a watermark using the Add Ellipse to Document workflow action. Customize the dimensions, position, and style of the ellipse to match your needs. The parameters are as follows.

QR code watermark

Easily add QR codes as watermarks to your documents using the Add QR Code Watermark to Document workflow action. This feature lets you encode information, such as URLs or text, into scannable QR codes, providing an interactive element in your documents.

The parameters are as follows:

  • Content — Enter the content to embed in the QR code. Ensure it aligns with the chosen input mode for accurate encoding.

  • Version — Choose the appropriate QR code version, ranging from Auto to Version01 – Version40, based on the complexity and size of your QR code.

  • Input mode — Specify the encoding mode:

    • Binary — Supports any value, including text and URLs.
    • AlphaNumeric — Allows numbers, uppercase letters, spaces, and characters such as $, %, *, +, -, ., /, :
    • Numeric — Accepts numbers only.
  • Error correction level — Select the error correction level suitable for your QR code’s reliability: Low, Medium, Quartile, or High.

Barcode watermark

Easily add barcodes as watermarks to your documents using the Add Linear Barcode workflow action. This feature supports a wide range of barcode types, making it versatile for document tracking, auditing, or inventory management.

The parameters are as follows:

Applying composite watermarks using Microsoft SharePoint Designer workflows

The individual watermarking workflow actions, detailed in the previous sections, are user-friendly and effective. However, when combining multiple shapes — such as a circle, an image, and dynamic text — each watermark requires a separate internal cycle. While this approach works well for most scenarios, it may not be the most efficient for complex workflows.

To address this, the Add Composite Watermark to Document workflow action enables the application of multiple watermarks simultaneously, with each watermark consisting of one or more individual shapes.

The parameters are as follows.

The true power lies in the watermark.xml field, which contains the XML structure defining multiple watermarks and their elements.

Example of composite watermark XML

The following example demonstrates three watermarks:

  • Company logo — Adds an image of the company logo in the foreground, positioned at the top-right corner of every page.
  • User login ID — Places the login ID of the user who created or modified the document in a semi-transparent style at a random background location.
  • Page number — Automatically generates and applies page numbers at the bottom-right corner of each page.
<watermarks>
<!-- ** First watermark contains a single image element with the logo -->
<watermark
hPosition="right"
vPosition="top"
width="200"
height="73"
zOrder="1"
opacity="100"
pageOrientation="both">
<image
width="200"
height="73"
scaleMode="maintainaspectratio"
imageFilePath="watermarking/muhimbi-logo.gif" />
</watermark>
<!-- ** Second watermark places the user's name in the background -->
<watermark
hPosition="random"
vPosition="random"
width="300"
height="200"
zOrder="-1"
rotation="-30"
opacity="15"
pageOrientation="both">
<text
width="200"
height="200"
fillColor="#000000"
content="Insert 'modified by' field using SharePoint Designer"
fontFamilyName="Times New Roman"
fontSize="24"
fontStyle="bold|italic"
wordWrap="word"
/>
</watermark>
<!-- ** Third watermark adds page numbering -->
<watermark
hPosition="right"
vPosition="bottom"
width="100"
height="40"
zOrder="1"
pageOrientation="both">
<text
hPosition="left"
vPosition="top"
width="100"
height="40"
content="Page {PAGE} of {NUMPAGES}"
fontFamilyName="Arial"
fontSize="11"
hAlign="left"
vAlign="top"
/>
</watermark>
</watermarks>

Understanding watermark components: A watermark represents a complete watermarking action. It’s a container that defines the overall placement, size, and properties of the watermark on the document page. This container can hold one or more elements, which are the individual components that make up the visual appearance of the watermark. These elements can include text, lines, shapes (like ellipses), images, rich text (RTF), PDF content, and even other nested watermarks. The following sections describe the various watermark elements that can be used to build a watermark. Each element can be used independently within a watermark container.

Text element

The text watermark element allows you to add custom text to the foreground or background of one or more pages in the target document. It provides full control over attributes such as font, style, size, and color.

Below is the XML structure for configuring a text watermark. Any attributes marked as “optional” can be excluded if not needed. However, retaining optional attributes with placeholder values like “optional” will result in an error:

<text
hPosition="optional (absolute, random, left, center, right)" vPosition="optional (absolute, random, top, middle, bottom)" x="optional"
y="optional"
width="required"
height="required"
zOrder="optional"
scaleMode="optional (absolute, exactFit, maintainaspectratio)" scaleX="optional"
scaleY="optional"
rotation="optional"
opacity="optional"
lineColor="optional"
lineWidth="optional"
fillColor="optional"
content="required"
fontFamilyName="optional"
fontSize="optional"
fontStyle="optional (regular, bold, italic, strikeout, underline)" wordWrap="optional (none, character, word, wordonly)" hAlign="optional (left, center, right, justify)"
vAlign="optional (top, middle, bottom)" />

The content attribute can include embedded field codes, such as the date or current page number, for dynamic watermarking.

If you expect a significant amount of content, consider removing the content attribute and placing the text directly inside the text element. For example:

<text
hPosition="optional (absolute, random, left, center, right)"
... rest omitted
>
Your content goes here, use a CDATA section if needed.
</text>

SharePoint Designer lookup variables are fully supported, enabling dynamic information from workflow variables or the item columns to be embedded directly into the watermark.

RTF element

The RTF watermark element enables the addition of simple RTF-encoded text as a watermark, providing greater control over the appearance of individual words. While it offers more design flexibility, it also introduces added complexity.

An example of valid RTF encoding is as follows:

{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard
This is some {\b bold} text.\par
}

The XML structure is as follows. You can exclude any attributes labeled as “optional” from your code when not required. Keeping them with the “optional” label will result in an error:

<rtf
hPosition="optional (absolute, random, left, center, right)"
vPosition="optional (absolute, random, top, middle, bottom)"
x="optional"
y="optional"
width="required"
height="required"
zOrder="optional"
scaleMode="optional (absolute, exactFit, maintainaspectratio)"
scaleX="optional"
scaleY="optional"
rotation="optional"
opacity="optional"
lineColor="optional"
lineWidth="optional"
fillColor="optional"
rtfData="required"/>

When a lot of content is anticipated, then you can remove the rtfData attribute and place it inside the <rtf> element — for example:

<rtf
hPosition="optional (absolute, random, left, center, right)"
... rest omitted
>
Your content goes here, use a CDATA section if needed.
</rtf>

Unlike the text element, the RTF element doesn’t support embedded field codes. However, Microsoft SharePoint Designer lookup variables are fully supported, allowing dynamic information stored in workflow variables or the item columns to be embedded in the element. When applied to Microsoft PowerPoint files, RTF elements are displayed as plain text.

Image element

The Image watermark element enables you to add common image types such as BMP, JPG, GIF, PNG, TIFF, WMF, and EMF/EMF+ as watermarks to documents.

The XML structure is as follows. You can exclude any attributes labeled as “optional” from your code when not required. Keeping them with the “optional” label will result in an error:

<image
hPosition="optional (absolute, random, left, center, right)"
vPosition="optional (absolute, random, top, middle, bottom)"
x="optional"
y="optional"
width="optional"
height="optional"
zOrder="optional"
scaleMode="optional (absolute, exactFit, maintainaspectratio)"
scaleX="optional"
scaleY="optional"
rotation="optional"
opacity="optional"
lineColor="optional"
lineWidth="optional"
fillColor="optional"
imageFilePath="required"/>

The image at this path parameter expects the complete path of the image relative to the current site, e.g. shared documents/images/company_logo.gif.

QR code element

Add various QR codes to documents using the QR code watermark element, which is perfect for embedding document IDs or any other SharePoint metadata.

The XML structure is as follows. You can exclude any attributes labeled as “optional” from your code when not required. Keeping them with the “optional” label will result in an error:

<qrcode
hPosition="optional (absolute, random, left, center, right)"
vPosition="optional (absolute, random, top, middle, bottom)"
x="optional"
y="optional"
width="optional"
height="optional"
zOrder="optional"
rotation="optional"
opacity="optional"
fillColor="#optional"
lineColor="#optional"
scaleMode="optional (absolute, exactFit, maintainaspectratio)"
scaleX="optional"
scaleY="optional"
text="required"
errorCorrectionLevel="optional (Low, Medium, Quartile, High)"
inputMode="required (Binary, AlphaNumeric, Numeric)"
version="optional (Auto, Version01, Version02, Version03
... Version40)" />

Linear barcode element

Add a variety of barcode watermark elements to documents, perfect for embedding tracking numbers and other important metadata.

The XML structure is as follows. You can exclude any attributes labeled as “optional” from your code when not required. Keeping them with the “optional” label will result in an error:

<linearBarcode
hPosition="optional (absolute, random, left, center, right)"
vPosition="optional (absolute, random, top, middle, bottom)"
x="optional"
y="optional"
width="optional"
height="optional"
zOrder="optional"
rotation="optional"
opacity="optional"
fillColor="#optional"
lineColor="#optional"
scaleMode="optional (absolute, exactFit, maintainaspectratio)"
scaleX="optional"
scaleY="optional"
text="required"
barcodeType="required (Codabar, Code11, Code32, Code39, Code39Extended, Code93, Code93Extended, Code128, Code128A, Code128B, Code128C, GS1Code128)"
omitStartStopSymbols="optional"
disableCheckDigit="optional"
showCheckDigit="optional"
textLocation="optional (Bottom, None, Top)"
barcodeToTextGapHeight="optional"
fontFamilyName="optional"
fontSize="optional"
fontStyle="optional (regular, bold, italic, strikeout, underline)"
textAlignment="optional (Default, Center, Justify, Left, Right)"
margin="optional" />

PDF element

Use existing PDF files as watermark elements. An example of this could be a dynamic PDF generated from a Microsoft Word document and converted via Nutrient Document Converter, or a static PDF created manually.

The XML structure is as follows. You can exclude any attributes labeled as “optional” from your code when not required. Keeping them with the “optional” label will result in an error:

<pdf
hPosition="optional (absolute, random, left, center, right)"
vPosition="optional (absolute, random, top, middle, bottom)"
x="optional"
y="optional"
width="optional"
height="optional"
zOrder="optional"
scaleMode="optional (absolute, exactFit, maintainaspectratio)"
scaleX="optional"
scaleY="optional"
rotation="optional"
opacity="optional"
lineColor="optional"
lineWidth="optional"
fillColor="optional"
pdfFilePath="required" />

The PDF file path parameter expects the complete path of the PDF name relative to the current site, e.g. shared documents/static watermarks/company_logo.pdf.

PDF-based watermark elements can only be applied to other PDF documents. It isn’t possible to apply PDF-based watermark elements to Microsoft Office file formats.

Rectangle element

A simple rectangle can be added as a watermark element.

The XML structure is as follows. You can exclude any attributes labeled as “optional” from your code when not required. Keeping them with the “optional” label will result in an error:

<rectangle
hPosition="optional (absolute, random, left, center, right)"
vPosition="optional (absolute, random, top, middle, bottom)"
x="optional"
y="optional"
width="required"
height="required"
zOrder="optional"
scaleMode="optional (absolute, exactFit, maintainaspectratio)"
scaleX="optional"
scaleY="optional"
rotation="optional"
opacity="optional"
lineColor="optional"
lineWidth="optional"
fillColor="optional" />

Line element

A line can be added as a watermark element.

The XML structure is as follows. You can exclude any attributes labeled as “optional” from your code when not required. Keeping them with the “optional” label will result in an error:

<line
hPosition="optional (absolute, random, left, center, right)"
vPosition="optional (absolute, random, top, middle, bottom)"
x="required"
y="required"
endX="required"
endY="required"
zOrder="optional"
scaleMode="optional (absolute, exactFit, maintainaspectratio)"
scaleX="optional"
scaleY="optional"
rotation="optional"
opacity="optional"
lineColor="optional"
lineWidth="optional" />

Caveats

Different file formats come with unique limitations, and it’s important to be aware of potential issues when applying watermarks.

PDF is the most versatile format for watermarking, allowing for precise placement on individual pages. However, other file formats may have limitations.

  1. Modern Office formats only: Watermarking is supported only in modern Office formats (DOCX, XLSX, PPTX). Legacy formats (DOC, XLS, PPT) aren’t supported. Use Nutrient Document Converter to convert older documents to modern formats for watermarking.

  2. Layering/z-order: This is true for PDF as well, but make sure you don’t hide your watermarks behind your document’s content. For example, placing your watermark in the background of a non-transparent document, such as a scan, will hide the watermark.

For Microsoft Excel and Word, watermarks are always located behind the document’s main content. However, they’re treated specially and they’re designed to be visible through the text.

  1. Targeting individual pages: PDF and PowerPoint files allow targeting specific pages for watermarks. However, in Microsoft Word and Excel, watermarks are applied to the entire section or worksheet. In Word, to target a specific page, it must be in its own section. In Excel, all pages in a worksheet share the same watermark, but different watermarks can be applied to different sheets.

  2. Mandatory Microsoft Word headers: Watermarks in Microsoft Word are applied via page headers. Ensure headers haven’t been removed from sections, as our software cannot add watermarks to sections without headers.

  3. Real-time watermarking in Microsoft SharePoint (on-premises): Due to the complexities of integrating with various on-premises versions of Microsoft SharePoint, Nutrient Document Converter manages the interaction between Office applications and real-time watermarking to ensure consistent behavior. Specifically, to prevent conflicts, co-authoring (simultaneous editing by multiple users) is disabled on document libraries where real-time watermarking is enabled and the Apply when editing setting is active.

    The Apply when editing setting is crucial for reliable real-time watermarking, especially with newer SharePoint versions. Because of how Office applications retrieve files, this setting ensures watermarks are consistently applied during the editing process, and it’s strongly recommended for real-time watermarking scenarios. However, this restriction does not apply to watermarks applied via SharePoint workflows, as those operate outside the real-time editing context.

  4. Office Web apps: For real-time watermarking, use Internet Explorer in combination with Office Web apps and set Default open behavior to Open in the client application rather than Open in the browser (found in Advanced Library Settings).

  5. Real-time watermarking on read-only files recommended: If real-time watermarking is applied every time a document is opened, the watermark could be reapplied every time the document is saved and opened again. To prevent this, use filters or enable real-time watermarking only on read-only documents or folders.

  6. RTF watermarks in Microsoft PowerPoint: RTF-based watermarks are supported in most file formats but are displayed as plain text in Microsoft PowerPoint without formatting.

  7. Microsoft Excel watermarks require one free header/footer slot without an image: In Excel, watermarks are applied via headers and footers. At least one header/footer slot must be free of images for watermarking to work. Nutrient Document Converter requires this empty slot.