Page 1 of 1

Selectable footer text for pdf

Posted: Fri Oct 21, 2022 10:51 pm
by Jeff_Reynolds
Hi folks,

Might be getting too fancy here, but is there a way I can select footer text at build time when using Publishing templates?

Instead of hardcoding footer text could I inject it by selecting a parameter at build time?

Something like:

Edit a transformation scenario
1. Select a scenario
2. Select a security level, pick from Public, Internal only, Confidential.
3. Let'er rip.

Re: Selectable footer text for pdf

Posted: Mon Oct 24, 2022 1:52 pm
by julien_lacour
Hello Jeff,

Sure you can, for example with the following CSS:

Code: Select all

/* args.css.param.security-level */
:root[security-level='public'] {
  string-set: security-level "Public";
}
:root[security-level='internal'] {
  string-set: security-level "Internal only";
}
:root[security-level='confidential'] {
  string-set: security-level "Confidential";
}

@page chapter:first:left, chapter:first:right , chapter:left, chapter:right{
  @bottom-center {
    content: string(security-level);
  }
}
And then by declaring the 'args.css.param.security-level' in the publishing template file:

Code: Select all

<parameters>
  <parameter name="args.css.param.security-level" value="confidential"/>
</parameters>
Regards,
Julien

Re: Selectable footer text for pdf

Posted: Mon Oct 24, 2022 2:00 pm
by julien_lacour
Another solution is to use an XPath expression with the value to be displayed in the PDF:

Code: Select all

<bookmeta>
  <data name="security-level" value="Internal only"/>
</bookmeta>
In this case the CSS rule should be the following:

Code: Select all

:root {
  string-set: security-level oxy_xpath("//*[contains(@class, 'bookmap/bookmeta')]//*[contains(@class, 'topic/data')][@name='security-level']/@value");
}

@page chapter:first:left, chapter:first:right , chapter:left, chapter:right{
  @bottom-center {
    content: string(security-level);
  }
}
Regards,
Julien

Re: Selectable footer text for pdf

Posted: Mon Oct 24, 2022 4:04 pm
by Jeff_Reynolds
Thanks Julien!