’Add watermarks to documents using Nintex workflow’

Nintex

The SharePoint add-in model used in this guide has been deprecated by Microsoft(opens in a new tab) and will be fully retired as of 2 April 2026. As a result, the instructions outlined here may no longer be valid or supported.
- We strongly recommend that new users leverage Nintex Automation Cloud for their workflow automation needs. To facilitate document conversion within this environment, we released the Nutrient Document Converter Xtension(opens in a new tab) for Nintex Automation Cloud.
- Existing users who are still using the SharePoint add-in model are encouraged to migrate to Nintex Automation Cloud to ensure continued compatibility and support.

In this guide, you’ll learn how to add watermarks to documents using Nintex workflows. These workflow actions allow elements such as text, rectangles, images, PDF files, QR codes, barcodes, and other shapes to be added as a watermark to a wide variety of documents.

This article covers the watermarking of documents using Nintex workflows and Nintex Workflow for Office 365.

Using Nintex Workflow for Office 365 for watermarking

Prerequisites

Before you begin, make sure the following prerequisites are in place:

Note that this article is for the MS SharePoint Online version of Nintex Workflow.

Building the workflow

Follow the instructions below:

  1. Navigate to a site collection and document library of your choice. You can choose the option to create a new Nintex workflow. This example uses the standard document library that’s available on most site collections.

  2. Create the following workflow variables, which you’ll need later:

  • JSON (Text) — Contains the JSON(opens in a new tab), which is the command that will be sent to the conversion service.

  • API_KEY (Text) — A unique ID that will be used to look up your Nutrient Document Converter subscription details.

  • ResponseText (Text) — The status message returned by the conversion service.

  • ResponseCode (Integer): The status code returned by the conversion service.

    workflow variables

  1. You can then insert a Set Workflow Status action, edit it, and set it to Started. As MS SharePoint Online doesn’t show a separate status, adding this action will show you the status that the workflow has actually triggered, and it’ll also give you something to click to inspect the current status of the workflow.

    set workflow status

  2. You can then add a Build String action and set the Output to the JSON workflow variable. In the String field, enter the following:

[
"sharepoint_file": [
"site_url": "{Workflow Context:Current site URL}",
"source_file_url": "{Current Item:Server Relative URL}",
"destination_file_url": "{Current Item:Server Relative URL}.pdf"
],
"output_format": "PDF",
"fail_on_error": true
]

build string action

Pay attention to the following:

JSON notation — Note that we replaced the curly braces - { } - with square brackets [ ] due to a bug in Nintex Workflow for Office 365. If you have any concerns using square brackets, as they’re also used for array types, you can replace them with anything else, since you’ll fix this in a follow-up step.

Copy and paste — When copying and pasting the JSON code, ensure you paste it in Notepad and copy it back to strip out non-standard characters and formatting from being copied.

References — The text displayed in red is that of Nintex workflow references. After copy-pasting the code fragment, replace each Nintex reference using the advanced lookup facility located below the field.

Output file name — In this basic example, you’ll add .pdf to the end of the output path and file name. This isn’t particularly pretty, but to keep things simple, you aren’t including the Nintex workflow actions to strip off the old extension and add the new one. You can use whatever you like here as long as it’s a valid output path and file name.

  1. In an earlier step, you need to replace the square brackets with curly braces again. You can do this by using the Replace Substring in String action and configuring it as follows:
  • Search String — Enter the opening square bracket [.
  • Replace String — Enter the opening curly brace {.
  • String — Insert a reference to the workflow variable named JSON.
  • Output — Pick the JSON workflow variable to store the results in.

Click Save.

  1. You can now copy the workflow action using the action’s menu and by pasting it as the next action. Configure the newly pasted workflow action and replace the opening bracket with the closing bracket ']'.

You can do the same for the curly brace and replace '{' with '}', and click Save to save the action. You now have valid JSON that you can send to the conversion service.

  1. As the next step, you need to set the API_KEY. Insert a Set Workflow Variable action and configure it to set the API_KEY workflow variable to the API key you received by email when signing up for Nutrient Document Converter Services Online, e.g. decafbad-baad-baad-baad-decafbaaaaad.

Don’t try to use this particular key, as it won’t work. Ensure you don’t put curly braces around the key. Click Save to save the action.

  1. Next, insert a Web Request action and configure it as follows:

URL — https://api.muhimbi.com/api/v1/operations/convert

Method — POST

Content type — application/json

Add header — Click Add header, specify API_KEY as the header name, and insert a reference to the API_KEY workflow variable for the header value.

Body — Select the Content option, and add a reference to the JSON workflow variable in the Data field.

Store response content in — ResponseText.

Click Save to save the action.

  1. Finally, insert another Set Workflow Status action and configure it with the text Completed. This should indicate when the workflow instance has completed its run.

  2. Save and publish the workflow by giving it a suitable name, and set Start Options to a value of your choice.

  3. Once published, open the document library the workflow is associated with, make sure a file of the supported type is present, and manually start the workflow. After a few seconds, the PDF file will show up next to the file the workflow was started on.

Troubleshooting

Although both Nintex Workflow for Office 365 and Nutrient Document Converter work very well together, there are a lot of moving parts in the workflow like custom generated JSON, customer-specific API keys, paths to the document libraries, etc. So, there are chances that you may encounter some issues when deploying the workflow. Some common issues and troubleshooting tips are provided below for your reference.

  • Check prerequisites — Double-check that the prerequisites listed in the beginning of this section are in place.
  • Log to History List — If it isn’t clear what’s wrong, log critical parts, such as the JSON workflow variable (after the replace operation), as well as the ResponseText workflow variable (after the web request) using the Log To History List workflow action. You can see the contents of this list by clicking on the Workflow Status column for the List Item the workflow is running on.
  • Send email — The amount of text that can be logged to the History List is limited (roughly 250 characters). For larger messages, use the Send an Email action instead to send an email with debug content in the body of the email to yourself.
  • Copy and paste — When copying the JSON fragment into your workflow, paste it into Notepad first to clean it, and then copy it from Notepad and paste it into your workflow. This is because browsers tend to insert hidden characters that aren’t filtered out by the Nintex workflow editor.
  • Nintex references — Make sure the Nintex workflow references in the JSON provided are replaced by actual Nintex workflow references. You can double-check if the references are active by logging the JSON workflow variable to the History List. You should see the actual paths and not {Current Item:Server Relative URL}.
  • Nutrient support — After double-checking all prerequisites and going over all troubleshooting steps in this section, if you’re still stuck, contact our Support team.

Finetuning

The workflow created in the previous section was to give a quick idea of how to use the converter. However, it’d benefit from error handling and a solution for a possible recursion problem where the workflow will be triggered for PDF files that it has created by itself.

Other operations

This section demonstrated how to invoke the Convert action on Nutrient Document Converter’s REST interface. Full examples are beyond the scope of this article, but you can find examples in the SharePoint section of our GitHub repository(opens in a new tab).

Using Nintex workflows for watermarking

Support for SharePoint Designer, a Web Services API, and a host of other watermarking functionality has been available for a while, but since version 5.1, we’ve added support for Nintex workflows as well.

In addition to the new PDF Watermarking Nintex Workflow Activity, we added activities for PDF security, PDF merging, and HTML-to-PDF conversion.

Similar to all other Nintex activities provided by Nutrient Document Converter, the watermark PDF activity integrates with Nintex workflow at a deep level. It supports SharePoint versions 2007, 2010, 2013, and 2019; it allows errors to be handled; and it even supports integration with Nintex iterators to deal with multiple items and loops.

For a comprehensive example and details about how to enable the Nintex workflow integration, refer to the blog post that discusses our generic Nintex PDF conversion activity.

nintex workflow nintex for office 365 set api key workflow activity watermark document watermark document watermark document

The fields supported by this workflow activity are as follows:

  • Destination Path — Enter the path to write the watermarked file to, either:
    • Leave it empty to use the same filename (and path) as the file that triggered the workflow.
    • A file name, without the full path, to write a differently named file to the same location as the source file.
    • A relative path to a subsite/document library/folder, e.g. Shared Documents/Some Folder/Some File.pdf.
    • An absolute path to a different site collection, e.g. /sites/Finance/Shared Documents/Some Folder/Some File.pdf. Ensure the path doesn’t include the host name, e.g. http://your site/.....
  • Watermark type — A number of different watermark types are supported. Unlike our individualSharePoint Designer workflow activities, all watermark types have been rolled up into a single Nintex activity. The functionality is largely the same. The following watermark types are supported.
    • Text — Add a text-based watermark with full control over the font type, size, style, rotation, and field codes, such as {PAGE}.
    • PDF — Add the first page of another PDF file as the watermark. This isn’t supported in Office file types.
    • QR code — Add a QR code as the watermark.
    • Linear barcode — Add a barcode watermark.
    • Image — Use a BMP, JPG, GIF, PNG, TIFF, WMF, or EMF / EMF+ file as a watermark.
    • RTF — Use RTF based text as a watermark
    • Ellipse — Add an ellipse-based watermark.
    • Line — Add a line-based watermark.
    • Composite — For complex watermarks, or watermarks consisting of multiple elements such as line, text, amd images, use the composite watermark in combination with our XML-based watermarking syntax.
  • Display — Either display the watermark always, or only when printing (when this is supported by the target file format).
  • Output List ID — If you wish to carry out further actions on the watermarked file, e.g. send it by email or perform a check-in, then you can optionally write the ID of the list the file was written to in a workflow variable of type string.
  • Output List Item ID — Similarly to PDF List ID, the Item ID of the watermarked file can optionally be written to a workflow variable of type Item ID (in SharePoint 2007) or Integer (in SharePoint 2010 and later versions).
  • Source List ID & List Item — The item that triggered the workflow is watermarked by default. You can optionally specify the ID of a different list and list item using workflow variables. Use the same data types as used by Output List ID and Output List Item ID.
  • Error handling — Similar to the way some of Nintex’s own workflow activities allow errors to be captured and evaluated by subsequent actions, all of Nutrient Document Converter’s workflow activities also allow the same. By default, this facility is disabled ,meaning that any error terminates the workflow.

Additional resources