Skip to main content
Participating Frequently
September 9, 2024
Answered

How to Add Bold to Java code in PDF

  • September 9, 2024
  • 2 replies
  • 920 views

Here is my code for the first line:

"<b>Client Services</b>+\r"+line1+line2+"Reviewers\r"+line3+line4+line5+line6+line7+

 

Here is the output:

Client Services<b>Client Services</b>+

 

How do I get it to add the bold without the <b>Client Services</b>+ after it?

 

This topic has been closed for replies.
Correct answer PDF Automation Station
event.target.richText=true;
var lines1="Line 1\rLine 2\r\r";
var lines2= "Line 3\rLine 4\rLine 5\rLine 6\rLine 7";

var spans = new Array();
spans[0] = new Object();
spans[0].text="Client Services\r";
spans[0].fontWeight=900;

spans[1] = new Object();
spans[1].text = lines1;

spans[2] = new Object();
spans[2].text="Reviewers\r"
spans[2].fontWeight=900;

spans[3] = new Object();
spans[3].text = lines2;

event.target.richValue=spans;

2 replies

PDF Automation Station
Community Expert
Community Expert
September 10, 2024
event.target.richText=true;
var lines1="Line 1\rLine 2\r\r";
var lines2= "Line 3\rLine 4\rLine 5\rLine 6\rLine 7";

var spans = new Array();
spans[0] = new Object();
spans[0].text="Client Services\r";
spans[0].fontWeight=900;

spans[1] = new Object();
spans[1].text = lines1;

spans[2] = new Object();
spans[2].text="Reviewers\r"
spans[2].fontWeight=900;

spans[3] = new Object();
spans[3].text = lines2;

event.target.richValue=spans;
jas963Author
Participating Frequently
September 10, 2024

Thank you!

PDF Automation Station
Community Expert
Community Expert
September 9, 2024

What is the context of your script?

jas963Author
Participating Frequently
September 9, 2024

There are check boxes that the user clicks and a summary of the user's selections on the final page. The line 1, line 2, line 3, and so on are the user's selections. The Client Services and Reviewers are headings to separate the sections.

 

Client Services

Line 1

Line 2

 

Reviewers

Line 3

Line 4

Line 5

Line 6

Line 7

PDF Automation Station
Community Expert
Community Expert
September 10, 2024

So it's a multi-line text field?