Copy link to clipboard
Copied
Hi everyone,
I created an interactive text box (Arial regular) to let the client fill by themselves, in which the first paragraph needs to be bold.
I know I can change it into the rich-text format and press ctrl+B to get bold text, but the client asks me to try.
Any ideas can help me?
Thank you.
Copy link to clipboard
Copied
You can use this code as the custom validation script of your field:
var v = event.value;
var lines = v.split("\r");
var spans = [];
for (var i=0; i<lines.length; i++) {
spans.push({text: lines[i]+"\r", fontWeight: (i==0) ? 800 : 500});
}
event.richValue = spans;
Copy link to clipboard
Copied
You can use a validation script to change the first line of the text they enter to bold, but it will only happen once they leave the field.
Copy link to clipboard
Copied
That ok! can you please give me that script~
More tutorials are awesome!
Copy link to clipboard
Copied
You can use this code as the custom validation script of your field:
var v = event.value;
var lines = v.split("\r");
var spans = [];
for (var i=0; i<lines.length; i++) {
spans.push({text: lines[i]+"\r", fontWeight: (i==0) ? 800 : 500});
}
event.richValue = spans;
Copy link to clipboard
Copied
Sorry for the late response!
The first thing is to thank you for your help, but somehow your code works really well, the reason I say "somehow" is because only some pdf files work with this code.
I don't know why but when I added this code it jumped to "held value is not validated", even if they all have the same size, font, setting, format.
Do you have any idea?
Thank you.
Copy link to clipboard
Copied
Make sure the option for Rich Text Formatting is selected.
Copy link to clipboard
Copied
I always choose that option, because when sending it to customers, I need to bold the first line anyway.
Copy link to clipboard
Copied
Can you share the actual file with us? You can attach it to the original message using the tiny paperclip icon at the bottom when you edit it, or upload it to a file-sharing website (like Dropbox, Google Drive, Adobe Cloud, etc.), generate a share link and then post it here.
Copy link to clipboard
Copied
Hi all,
I'm looking for a similar script but then one which makes all text bold in a interactive PDF text box.
Can anyone help me on this one?
Thanks.
Copy link to clipboard
Copied
You don't need a script to do this, if you want all the text in bold just select a bold font in the Appearance attributes.
PDF Acrobatic, InDesigner & Photoshoptographer

