watermark a pdf transform

Post here questions and problems related to editing and publishing DITA content.
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

watermark a pdf transform

Post 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?
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: watermark a pdf transform

Post by julien_lacour »

Hello,

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

Regards,
Julien
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

Re: watermark a pdf transform

Post 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).
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: watermark a pdf transform

Post 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
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

Re: watermark a pdf transform

Post by Jeff_Reynolds »

If there any way to pass a string in at build time?
andrei_pomacu
Posts: 39
Joined: Mon Jul 25, 2022 11:18 am

Re: watermark a pdf transform

Post 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
new_param.png (85.63 KiB) Viewed 531 times
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
Jeff_Reynolds
Posts: 37
Joined: Tue Apr 13, 2021 9:48 pm

Re: watermark a pdf transform

Post by Jeff_Reynolds »

Thank you!
Post Reply