Editing a PDF (specifically a user-editable form) using Adobe Acrobat, and using the PDF JavaScript API, is it possible to style separate substrings within a field value? Is there a markup language used, for example?
A bit of pseudocode for what I’m talking about:
This word is <red>red</red>, this word is <bold>bold</bold>. I have spoken.
The answer is to: a) Make sure the field type is rich text, and b) Use Adobe's JavaScript methods to set spans within the field's richValue property with the formatting desired, for example:
var field = this.getField("MyRichTextField");
var spans = new Array();
spans[0] = new Object();
spans[0].text = "This word is ";
spans[1] = new Object();
spans[1].text = "red";
spans[1].textColor = color.red;
field.richValue = spans;
Further details and a list of span properties can be found in Acrobat JavaScript Scripting Reference (https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/Acro6JS.pdf)