Native PDF: Note @type=other @othertype - is it possible to set language variable text for the @othertype? | Community
Skip to main content
Level 2
September 26, 2024
Solved

Native PDF: Note @type=other @othertype - is it possible to set language variable text for the @othertype?

  • September 26, 2024
  • 3 replies
  • 786 views

For the standard note types the language variable text is set successfully so it appears in the prefix-content:

 

<div class="note note" data-attr-type="note">
<span class="prefix-content">Note: </span>This is a note of type 'note'</div>

 

But for @14236791=other  @othertype I get:

 

<div class="other note" data-attr-othertype="respiratory-warning" data-attr-type="other">
<span class="prefix-content">Other: </span>This is a note of type 'other' with othertype set to respiratory-warning</div>

 

The prefix-content is related to @14236791=other and not @othertype.

 

Is there a way to set the language variable text for each @14236791=other @othertype combination?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by t_a12

Hi Mike,

This can be achieved by using following javascript in pdf template. Please feel free to edit it further to achieve desired result.


a. Add following javascript to resources for pdf template.

b. Use the added javascript in content div of page layout for the pdf template (as mentioned below).

c. Enable Javascript at preset level and select above template to preset.

d. Generate the pdf.

 

//Javascript window.addEventListener('DOMContentLoaded', function () { const elements = document.querySelectorAll('div.other.note[data-attr-othertype]'); elements.forEach(element => { const prefixSpan = element.querySelector('span.prefix-content'); if (prefixSpan) { prefixSpan.textContent = element.getAttribute('data-attr-othertype') + ': '; } }); });//Add js to content div in Page Layout <div data-region="content"> <script src="a.js" type="text/javascript"></script> </div>

 

Please let me know if this works for you.

 

Regards,

Tulika Aggarwal

3 replies

Adobe Employee
September 27, 2024

@mike-e 

Thank you for your query.

I further checked and found that dynamic prefixing for @othertype values is not supported currently.

I will be raising a Jira ticket requesting the implementation.

 

Thanks 

Prashant 

 

t_a12Adobe EmployeeAccepted solution
Adobe Employee
September 27, 2024

Hi Mike,

This can be achieved by using following javascript in pdf template. Please feel free to edit it further to achieve desired result.


a. Add following javascript to resources for pdf template.

b. Use the added javascript in content div of page layout for the pdf template (as mentioned below).

c. Enable Javascript at preset level and select above template to preset.

d. Generate the pdf.

 

//Javascript window.addEventListener('DOMContentLoaded', function () { const elements = document.querySelectorAll('div.other.note[data-attr-othertype]'); elements.forEach(element => { const prefixSpan = element.querySelector('span.prefix-content'); if (prefixSpan) { prefixSpan.textContent = element.getAttribute('data-attr-othertype') + ': '; } }); });//Add js to content div in Page Layout <div data-region="content"> <script src="a.js" type="text/javascript"></script> </div>

 

Please let me know if this works for you.

 

Regards,

Tulika Aggarwal

kautuk_sahni
Community Manager
Community Manager
October 16, 2024

@mike-e Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!

Kautuk Sahni