Merging dynamic data into watermarks using the PDF Converter for SharePoint
The new 5.0 release of the PDF Converter for SharePoint provides quite a few new improvements, but perhaps the most highly anticipated new feature is the ability to apply watermarks to documents the moment they are opened. Now, it doesn’t make any sense to apply the exact same watermarks over and over again as that would be very inefficient, what you really want to do is adding data specific to the user who is opening the document.
This post is the second in a four part series:
-
Applying user specific watermarks when a PDF document is opened in SharePoint.
-
Merging dynamic data into watermarks using the PDF Converter for SharePoint. ( This Post)
-
Specifying filtering criteria when automatically applying watermarks.
-
Apply User Specific PDF Security when a document is opened in SharePoint.
Adding this kind of dynamic information is done using merge fields, which can be entered directly into the watermarking text, for example:
PDF Opened by ‘{REMOTE_USER}’ on ‘{LONG_DATE}’ from IP ‘{REMOTE_ADDR}’
Which results in the following watermark:
Merge fields are not exclusive to the ‘ watermark on open’ functionality, there are several other ways that watermarks can be applied using the PDF Converter for SharePoint, for example using workflows or web services. However, field codes are not always available for a particular interface as, for example, the web service has no knowledge about anything that happens in SharePoint, and workflows are not always associated with an HTTP Context.
As they say, a picture is worth a thousand words, which is why we have made the following table available to clarify which merge fields are available and under what circumstances.
Available from
**Field Name****Description**
Web Service
Workflows
WM on Open
WM on Insert*
WM on Update*
{LONG_DATE}The long representation of the current date, e.g. 18 April 2011.VVVVV{LONG_TIME}The long representation of the current time, e.g. 12:35:48.VVVVV{DATE}The short representation of the current date, e.g. 7/03/2011.VVVVV{TIME}The short representation of the current time, e.g. 12:35.VVVVV{PAGE}The number of the current page in the PDF file. This value is automatically updated for every page.VVVVV{NUMPAGES}The total number of pages in the PDF file.VVVVVAny column name
Any SharePoint column / field defined on the list such as {Title}, {Author}. Please use (case sensitive) internal field names. See this list of internal field names.
_Using workflow fields_VV
(Lists only)V{HTTP_HOST}Returns the name of the Web server. This may or may not be the same as SERVER_NAME depending on type of name resolution you are using on your Web server (IP address, host header).V{HTTP_REFERER}
Returns a string that contains the URL of the page that referred the request to the current page using an HTML tag. Note that the URL is the one that the user typed into the browser address bar, which may not include the name of a default document.
V{HTTP_URL}Returns the raw, encoded URL, for example, “/vdir/default.asp?querystring”.V{HTTP_USER_AGENT}Returns a string describing the browser that sent the request.V{LOGON_USER}The Windows account that the user is impersonating while connected to your Web server. Use REMOTE_USER to view the raw user name that is contained in the request header. V{REMOTE_ADDR}The IP address of the remote host (identifying the user) that is making the request.V{REMOTE_HOST}
The name of the host that is making the request. If the server does not have this information, it will set REMOTE_ADDR and leave this empty.
V{REMOTE_USER}The name of the user as it is derived from the authorization header sent by the client, before the user name is mapped to a Windows account. If you have an authentication filter installed on your Web server that maps incoming users to accounts, use LOGON_USER to view the mapped user name.V{SERVER_NAME}The server’s host name, DNS alias, or IP address as it would appear in self-referencing URLs.V{URL}Gives the base portion of the URL, without any querystring or extra path information, for example, “/vdir/default.asp”.V{USER_NAME}The user’s name, if available (requires 7.2+).V{USER_EMAIL}The user’s email, if available (requires 8.0+).V
\* In SharePoint 2007 automatic watermarking during Inserts and Updates is available in Lists, but not in Doc Libraries. Use workflows instead.
If there is any other kind of data you would like to merge in as part of a watermark then leave a comment below or contact us directly and we’ll consider it for a future upgrade.
Clavin is a Microsoft Business Applications MVP who supports 1,000+ high-level enterprise customers with challenges related to PDF conversion in combination with SharePoint on-premises Office 365, Azure, Nintex, K2, and Power Platform mostly no-code solutions.