Watermark Documents using SharePoint Designer Workflows

In this guide you’ll learn how to add watermarks to documents using SharePoint Designer Workflows. These workflow actions allow elements such as text, rectangles, images, PDF files, QR Codes, barcodes as well as other shapes to be added to a wide variety of documents either in front of or behind the document’s content.

Each separate watermark workflow action is applied to the document separately. If multiple watermarks need to be applied in one go, you can do this using the Composite Watermark feature.

You can also add barcodes to MS Word, MS Excel, MS PowerPoint and PDF via MS SharePoint Designer workflows. We support most common barcode types including Codabar, Code11, Code32, Code39, Code39Extended, Code128, Code128A, Code128B, Code128C, GS1Code128, Code93 and Code93Extended.

Although there are many good reasons to automatically add barcodes to documents, the most common uses of this feature that we see with our customers is for document management. At some stage, documents will make their way outside of the document management system they are created and stored in. Barcodes can play an important role in ensuring and tracking these documents along with the auditing information using watermarks.

The individual workflow actions are self describing, but the following elements require special attention:

  1. this document: The document to apply the watermark to. For most workflows, selecting Current Item will suffice, but some scenarios require the lookup of a different item. You may also want to check that the file type of the document is a supported format (pdf, docx, xlsx, pptx).

  2. this file: The name and location of the watermarked file. Leave this field empty to overwrite the source file with the watermarked copy. Enter a path, including the Document Library and any folder names, if you want to write the watermarked file to a separate location. E.g. “shared documents/watermarked files/confidential.pdf”.

  3. List ID: The ID of the list the watermarked file was written to. This can later in the workflow be used to perform additional tasks on the file such as a check-in or out.

  4. Item ID: The ID of the watermarked file. Can be used with the List ID.

Text Watermark

This workflow action can be used to apply text to the foreground or background of one or more pages in the document with full control over the font, style, size and color.

The SharePoint Designer workflow action is named ‘Add Text watermark to Document’ and the parameters are as follows:

The text stored in the content field may contain embedded field codes such as the date or current page number. MS SharePoint Designer lookup variables are also supported, which makes it possible for dynamic information stored in workflow variables, or in the Item’s columns, to be embedded in the watermark.

RTF Watermark

The RTF watermark allows simple RTF encoded text to be added as a watermark. This allows more control over the look and feel of individual words in the watermark at the cost of added complexity.

An example of valid RTF is as follows:

The MS SharePoint Designer workflow action is named ‘Add RTF watermark to Document’ and the parameters are as follows:

Note: Unlike the Text Watermark, the RTF Watermark does not support embedded field codes. However, MS SharePoint Designer lookup variables are fully supported to make it possible for dynamic information stored in workflow variables, or in the item’s columns, to be embedded in the watermark. RTF Watermarks are displayed as plain text when applied to MS PowerPoint files.

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.

The MS SharePoint Designer workflow action is named ‘Add Image watermark to Document’ and the parameters are as follows:

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

PDF Watermark

Existing PDF files can also be used as a watermark. This could be a dynamic file that is generated from, for example MS Word, and then converted to PDF using the Muhimbi PDF Converter. Alternatively, this could be a static PDF file that has been generated manually.

The MS SharePoint Designer workflow action is named ‘Add PDF watermark to Document’ and the parameters are as follows:

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

Note: PDF based watermarks can only be applied to other PDF documents. It is not possible to apply a PDF Watermark to Office file formats.

Rectangle Watermark

A simple rectangle can be added as a watermark using the ‘Add Rectangle to Document’ workflow action. The parameters are as follows:

Line Watermark

A line can be added as a watermark using the ‘Add Line to Document’ workflow action. The parameters are as follows:

Ellipse Watermark

A circle or ellipse can be added as a watermark using the ‘Add Ellipse to Document’ workflow action. The parameters are as follows:

QR Code Watermark

A QR Code can be added as a watermark using the ‘Add QR Code Watermark to Document’ workflow action.

The fields are as follows:

Content: The content to embed in the QR code. This will need to match the specified input mode.

Version: Over the years many different QR versions have been introduced. Select the one appropriate to your needs, either Auto or Version01 – Version40.

Input mode: Specify the appropriate mode for your content:

  • Binary: Any value including text, URLs etc.
  • AlphaNumeric: Numbers, (Upper case) characters and SPACE, $, %, *, +, -, ., /, :
  • Numeric: Numbers only

Error correction level: Select the appropriate level for your needs: Low, Medium, Quartile, High

Barcode Watermark

A number of different barcode types can be added as a watermark using the ‘Add Linear Barcode’ workflow action.

The fields, specific to this watermark type, are as follows:

  • Type: The barcode type including Codabar, Code 11, Code 32, Code 39,
    Code 93, Code 128 (A/B/C), GS1-128.
  • Content: For the barcode content, please ensure that the specified content is compatible with the data that may be stored in the selected barcode type.
  • Check digit: If relevant to the barcode type, calculate and encode the check digit into the barcode.

Applying Composite Watermarks using MS SharePoint Designer Workflow

The individual watermarking workflow actions described in the previous section are relatively easy to use. The disadvantage however is that if you wish to combine multiple different shapes, e.g. a Circle, an Image and some dynamic text, then a separate watermarking cycle is carried out internally for each shape. This works well and will be fast enough for most occasions, but it is not the most efficient way to do it.

The separate ‘Add Composite Watermark to Document workflow’ action allows multiple watermarks to be applied in one go with each watermark made up of one or more individual shapes.

The workflow parameters are as follows:

The real power comes as part of the watermark.xml field that stores the XML that describes the multiple watermarks and elements.

The XML for each individual shape is described below, but before we go into more details let’s start with an example.

The following sample code describes three watermarks.

  • The first adds an image of the company logo (in the foreground) to the top right of each page in the document.
  • The second adds the login id of the user who created / changed the document to a random location in the background in a semi-transparent way.
  • The third adds an automatically generated page number to the bottom right of each page.

Text Element

This watermark can be used to apply text to the foreground or background of one or more pages in the target document, with full control over the font, style, size and color.

The XML looks as follows. You can omit any attributes marked as optional from your code when they are not needed. Leaving them in with the ‘optional’ text will cause an error:

The text stored in the content attribute may contain embedded field codes such as the date or current page number.

When a lot of content is anticipated then you may want to remove the content attribute and instead place it inside the text element, for example:

SharePoint Designer lookup variables are also supported, which makes it possible for dynamic information stored in workflow variables, or in the Item’s columns, to be embedded in the watermark.

RTF Element

The RTF watermark allows simple RTF encoded text to be added as a watermark. This allows more control over the look and feel of individual words in the watermark at the cost of added complexity.

An example of valid RTF is as follows:

The XML looks as follows. You can omit any attributes marked as optional from your code when they are not needed. Leaving them in with the ‘optional’ text will cause an error:

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

Note: Unlike the Text Watermark, the RTF Watermark does not support embedded field codes. However, SharePoint Designer lookup variables are fully supported to make it possible for dynamic information stored in workflow variables, or in the Item’s columns, to be embedded in the watermark. RTF Watermarks are displayed as plain text when applied to MS PowerPoint files.

Image Element

You can use the Image Watermark to add common image types (BMP, JPG, GIF, PNG, TIFF, WMF, EMF / EMF+) as a watermark to a document.

The XML looks as follows. You can omit any attributes marked as optional from your code when they are not needed. Leaving them in with the ‘optional’ text will cause an error:

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

QRCode Element

A range of different QR Codes can be added to documents using watermarks, ideal for embedding the document ID, or any kind of other SharePoint metadata.

The XML looks as follows. You can omit any attributes marked as optional from your code when they are not needed. Leaving them in with the ‘optional’ text will cause an error:

Linear Barcode Element

A range of different barcodes can be added to documents, ideal for embedding tracking numbers, and other metadata.

The XML looks as follows. You can omit any attributes marked as optional from your code when they are not needed. Leaving them in with the ‘optional’ text will cause an error:

PDF Element

Existing PDF files can also be used as a watermark. This could be a dynamic file that is generated from, for example from a MS Word document, and then converted to PDF using the Muhimbi PDF Converter. Alternatively, this could be a static PDF file that has been generated manually.

The XML looks as follows. You can omit any attributes marked as optional from your code when they are not needed. Leaving them in with the ‘optional’ text will cause an error:

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

Note: PDF based watermarks can only be applied to other PDF documents. It is not possible to apply a PDF Watermark to MS Office file formats.

Rectangle Element

A simple rectangle can be added as a watermark.

The XML looks as follows. You can omit any attributes marked as optional from your code when they are not needed. Leaving them in with the ‘optional’ text will cause an error:

Line Element

A line can be added as a watermark.

The XML looks as follows. You can omit any attributes marked as optional from your code when they are not needed. Leaving them in with the ‘optional’ text will cause an error:

Caveats

Different file formats have their own peculiarities and so it is important to be aware of the limitations and potential issues that may arise using them.

PDF is the ideal format when it comes to watermarking. You can place content anywhere on a page with pixel perfect precision, and each individual page can be targeted exactly. Unfortunately, that is not the case for all file formats.

  1. Modern Office formats only: Watermarking is only supported in modern Office formats (DOCX, XLSX, PPTX). The legacy formats (DOC, XLS, PPT) are not supported. If this causes issues, then use Muhimbi PDF Converter to convert old style documents to their modern equivalents, and then perform 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. Note: For MS Excel and MS Word, watermarks are always located behind the document's main content.

  3. Targeting individual pages: PDF and MS PowerPoint files allow individual pages to be targeted. For example, add the watermark only on the third or last page of the presentation. Unfortunately, this is not possible with MS Word and MS Excel.

In MS Word, watermarks are applied to an entire section. So, it is not possible to target a watermark to a specific page unless that page has its own section. In MS Excel, it is not possible to target individual pages either, and all pages in a worksheet automatically get the same watermark.

It is possible to apply different watermarks to different sheets in the workbook though. If configured accordingly in MS Excel and MS Word, the first page can have a different watermark compared to other pages.

  1. Mandatory MS Word Headers: Watermarks are added in MS Word via page headers. When applying watermarks to MS Word files, it is therefore essential that the headers have not been removed from sections. Our software cannot add watermarks to sections without headers.

  2. Real-time watermarking in MS SharePoint (on premise): The interaction between MS Office and different MS SharePoint on premise versions is extremely complex. To keep things manageable, our software disables co-authoring (multiple people editing the same document at the same time) on libraries that have real-time watermarking enabled and where 'Apply when editing' setting is enabled.
    Due to the way Office files are fetched, for the more modern MS SharePoint versions, it is recommended to enable the 'Apply when editing' setting to make sure watermarks are consistently applied. This only applies to real-time watermarking, applying watermarks via workflows does not suffer from this limitation.

  3. Office Web Apps: When using real-time watermarking and Internet Explorer is used in combination with Office Web Apps, we recommend setting the 'Default open behavior' to 'Open in the client application' and not to 'Open in the Browser' ('Advanced Library Settings’ for the relevant Lists and Libraries).

  4. Real-time Watermarking on Read-Only Files Recommendation: Before implementation, it is recommended that a detailed planning is done on how your documents will be used. For example, let's say automatic watermarking is enabled every time a document is opened. A user opens the document for editing purposes (which applies a watermark automatically). The document is then saved including the new watermark. When the document is then opened again, a watermark is applied again and again it is opened. It is for this reason that we recommend using either a filter to only apply real-time watermarks for certain situations, or to only enable real-time watermarking on read-only documents or folders specially created and maintained for sharing these watermarked documents.

  5. RTF Watermarks in MS PowerPoint: We support many watermark types including one that allows rich text to be inserted via RTF. Unfortunately RTF is ignored in MS PowerPoint, and it only displays the textual content embedded in the RTF without formatting.

  6. MS Excel Watermarks Require one free Header / Footer Slot Without Image: In MS Excel, watermarks are added via headers and footers. MS Excel has six slots, three in the header and three in the footer. Muhimbi's software requires at least one slot to have no image present or it will not be able to apply the watermark.

Have a Question?
We’re Always Happy to Help.

© Muhimbi Ltd. 2008 - 2024
This website uses cookies to ensure you get the best experience. Learn more