Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can I add a watermark to a page?

Daniel Serodio May 14, 2012

How can I add a "Draft" or "Obsolete" watermark to a page in Confluence?

5 answers

1 accepted

2 votes
Answer accepted
CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2012
I developed a user macro to do this, using jQuery to position an attached image within the body of the page. You'll see it explained in this presentation I gave at the Atlassian Summit in 2011. Confluence has evolved since then, so it may need tweaking to work with the latest version. http://www.atlassian.com/company/about/events/summit/2010/presentations/collaboration-and-projects/macros-reports-confluence.jsp
Daniel Serodio May 21, 2012

Perfect, that's exactly what I was looking for, thanks. Is that macro available for download?

CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2012

I've taken the original macro and updated it for Confluence 4.x. You'll find it in the shared user macro library here.

Like Michael Taylor likes this
Doods Perea September 30, 2013

Hi Charles - is this macro compatible with Confluence version 5.2? I tried using the macro but the image won't show on the page that contains the watermark image. I tried both providing the full URL and just the actual name of the image.

CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2013

Hi Doods,

I just tried the macro with Confluence 5.0 and it works just like it does under 4.x, both for the Documentation theme and the default theme.

In my simple test I uploaded an image file as an attachment to the page where I want the watermark to appear, then just used the image file name and extension in the parameter for the user macro.

If you're doing the same, then it would help to inspect what's going on with the aid of some browser development tools, e.g. Firebug.

The general approach is for the watermark image to be added as a background image using javascript to the main div element which is the container for the page content. For the documentation theme this div element has the class "wiki-content". For the default theme this div is/was identifiable with an ID of "content". It could be that in 5.2 this has changed. I don't have an instance of 5.2 handy though...

Which theme are you using when you try out the macro?

Charles

0 votes
Rethabile Morena June 18, 2018

Thanks for this macro - works like a charm.

Is it possible to incorporate the ability for the macro to appear when the content is exported (Word/PDF)? Currently it does not.

Regards

Rethabile M

0 votes
Dave Nurney May 23, 2018

Charles, I know this macro was written some years ago, but we are setting up an enterprise intranet using confluence and we have installed your watermark macros with Confluence 6.8.1 to provide the ability for users to create pages with a watermark or background image.

We have just had the solution pen tested and the report advises that there is a potential vulnerbility with your macro:

This macro passed the imgsrc parameter unsanitised to the code, so the jQuery function could be broken out of and closed, and malicious JavaScript executed afterwards. In order to do this, the value had to start with http or else it would be manipulated by the pre-processor.
The consultants were able to use this macro with the following payload and get JavaScript execution.

http://')} </script><script>alert("ptp xss")</script>

 

Is there anyway you could possibly update your macro to remove this vulnerability?

@CharlesH1 @[deleted]

0 votes
Paulina Riera January 19, 2014

We are on an older Confluence version. Is this macro compatible with 3.5 and on the documentation theme?

Thanks.

-p

CharlesH
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2014
It should do (especially the code offered in the slideshare presentation) as I created the user macro against that version and theme I think. Give it a try is the best advice I think.
0 votes
Renjith Pillai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2012

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events