Tip: a dynamic watermark defined by variables!

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.

Tip: a dynamic watermark defined by variables!

Postby AlexFox on Mon Feb 12, 2018 9:28 am

Hi all,

I've seen a few threads around adding watermarks easily to PDFs so I thought I'd share what I put together the other day. This is a watermark that you can enable/disable via conditional text and when enabled, you can change the caption, colour, font-size (whatever you like really) via variables.

Step 1:
Create a new Condition Tag/Set and call it Watermark (for example) - I use a several elements in my PageLayouts that I toggle with conditional text, so my tag is Settings_PageLayouts.Watermark

Step 2:
Create a new Variable set called Watermark and add the HTML attributes you'll want to be able to change in the future (note that you don't need to name them per the HTML spec, I just have out of habit):

Step 3:
In the PageLayout you'd like the watermark to appear on, create a new decoration frame and position it as you'd like the watermark to appear.
Edit the frame contents and add a <p> block with the contents [%=Watermark.Caption%] (assuming you called your Variable set 'Watermark' and the definition you wish to use for the content of your watermark 'Caption').
Conditionally tag the <p> block with your newly added condition from step 1.
Save the frame contents and remember to sink it to the bottom of the canvas (Layout > Depth > Sink to Bottom) to ensure the watermark does not appear on top of the body content of your PDF.

Step 4:
Save and close the PageLayout, then re-open it in the Internal Text Editor
Locate the code for the frame you've just added, it will look something like:
Code: Select all
<Frame X="30px" Y="124px" Width="210px" Height="58px" Flow="decoration4" Right="362px" Bottom="749px">
    <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml">
        <xhtml:p MadCap:conditions="Settings_PageLayouts.Watermark">[%=Watermark.Caption%]</xhtml:p>

Edit the <xhtml:p> so that it reads:
Code: Select all
<xhtml:p xhtml:style="text-align: center;text-transform: [%=Watermark.text-transform%];font-weight: [%=Watermark.font-weight%];font-style: [%=Watermark.font-style%];color: [%=Watermark.color%];font-size: [%=Watermark.font-size%];" MadCap:conditions="Settings_PageLayouts.Watermark">

Save the PageLayout and re-open it in the WYSIWYG editor, you may then copy and paste this frame onto any additional pages you may need to (you'll need to sink the body frame to the bottom to be able to select the watermark frame, remember to sink the watermark frame(s) to the bottom before saving).

Save and close the PageLayout, you'll now be able to set up a Print Target to use the selected PageLayout and you'll be able to dynamically change the Watermark each time whenever you need to. I recommend using the Variable settings I posted above, especially the #f0f0f0 colour as it's the closest you'll get to actual transparency.

Hope you find this useful!
Propeller Head
Posts: 61
Joined: Thu Oct 19, 2017 1:56 am

Re: Tip: a dynamic watermark defined by variables!

Postby AlexFox on Mon Feb 12, 2018 9:35 am

This is a slightly similar solution to this post however with this solution you can edit the attributes of the watermark and not just the text.
Propeller Head
Posts: 61
Joined: Thu Oct 19, 2017 1:56 am

Return to Printed Documentation Targets

Who is online

Users browsing this forum: Google [Bot] and 2 guests