These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

text properties

StevenDL
Registered: Jun 4 2010
Posts: 15

I have a few text field that are rich text and I would like to able to bold or italicize selected text and only that. Is there anyway I can allow bold/italic change, but not allow change font or font size?

My Product Information:
Acrobat Standard 9.3.1, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Yes, rich text is divided into spans, where each span is a section of text with the same characteristics. Switching a span to bold or italics is very simple. However breaking up a text string into spans is not so simple. There are a lot of different ways to approach a solution depending on how you want things identified. Are you good at scripting?

One of the simplest methods is to use regular expression to identify the locations of all words of interest and then split the full text into spans that way. This would be done in a loop. Something like this.

do{
<... Find Word of interest in String...>
<... Break off first part and Word from main string, string is now shorter...>
<... Create spans for first part and word ...>
}while( string is not empty);

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script