Page 1 of 1

watermark a pdf transform

Posted: Thu Aug 17, 2023 10:24 pm
by Jeff_Reynolds
Does anyone have a setup for passing a string from a DITA Scenario parameter (like args.css.param.watermark), to watermark a pdf?

Re: watermark a pdf transform

Posted: Fri Aug 18, 2023 8:57 am
by julien_lacour
Hello,

What Oxygen version are you using and what transformation scenario are you running?

Regards,
Julien

Re: watermark a pdf transform

Posted: Fri Aug 18, 2023 4:39 pm
by Jeff_Reynolds
Hi Julien,

I have Editor 23.0. I am running a PDF xform using HTML & CSS, through the Ashes publishing template (with some CSS changes).

Re: watermark a pdf transform

Posted: Mon Aug 21, 2023 9:24 am
by julien_lacour
Hello,

The How to Add a Draft Watermark on All Pages topic from our user-guide will surely help you.

Starting with Oxygen 25.0 it is possible to add the watermark in the foreground, if you upgrade to this version you can follow this topic instead.

Regards,
Julien

Re: watermark a pdf transform

Posted: Tue Aug 22, 2023 4:48 pm
by Jeff_Reynolds
If there any way to pass a string in at build time?

Re: watermark a pdf transform

Posted: Wed Aug 23, 2023 12:43 pm
by andrei_pomacu
Hi,
You could pass a string as a watermark path using a custom parameter.
Firstly, you need to create a new parameter with args.css.param as prefix, your parameter could look like this args.css.param.watermark and have as values the path towards an image file.

To create a parameter in Oxygen you need to edit your transformation scenario and add a new parameter with the name and value like in the picture below.
new_param.png
To actually add the image in the PDF view you need to catch the parameter value and and use it in PDF using CSS. To do that you need to use oxy_xpath() function. In the oxy_xpath you must locate the parameter added, so you need to catch it using the name after the args.css.param prefix. If you created an args.css.param.watermark parameter, the function will be oxy_xpath('/*/@*[local-name()="watermark"][1]').

Here is an example of how CSS rule should look like:

Code: Select all

@page {
  background-image: url(oxy_xpath('/*/@*[local-name()="watermark"][1]'));
  background-position: center;
  background-repeat: no-repeat;
  background-size: your_width your_height;
}
Regards,
Andrei

Re: watermark a pdf transform

Posted: Wed Aug 23, 2023 4:26 pm
by Jeff_Reynolds
Thank you!