Expand my Community achievements bar.

Paragraph Spacing on Text Fields

Avatar

Level 1

Hello,

I am creating an interactive PDF, and one of the things I am trying to do is set up a front end "panel" with questions that receive a user's input, and all these answers are then used to create a static letter, building the various parts from the different fields. I am good with the basic setup for doing this. However, the problem I have run into is on user input text fields that have multiple paragraphs (set as multi-line). I need to grab the text in these fields and place it in the final letter, styled to a certain design standard. I can set the font family and line spacing on the final static letter just fine.

But I have tried unsuccessfully to set a paragraph spacing. There are countless attributes, and every website seems to know a few, but not the right ones for this. I tried using "para.spaceBelow =" but this did not work. I also tried different "receiving" containers for the paragraphs on the final static form, such as a protected text field and a floating field in a basic text object. None of this seems to allow me to control the space between paragraphs, unfortunately. I am beginning to think I will have to ask the user to add separate paragraphs into unique text fields to grab the data and be able to space the paragraphs correctly.

I hope someone can help this.

Thanks,

Keith

1 Reply

Avatar

Level 10

Hi Keith,

If your input text field is set to rich text then you probably need to add the margin-top attribute to the style for the <p> element (which is the paragraph element), so;

default xml namespace =
"http://www.w3.org/1999/xhtml";

var richText = new
XML(TextField1.value.exData["##xHTML"].saveXML("pretty").replace(/^<\?xml\s+version\s*=\s*(["'])[^\1]+\1[^?]*\?>\n*/,
""))

for each (var p in richText.p) {

     p.@style = "margin-top:10pt;"

TextField2.value.exData.loadXML(richText.toXMLString(), /* Ignore root node */
false, /* Overwrite
content */
true);

Try this sample and see if it heading in the right direction.  https://sites.google.com/site/livecycledesignercookbooks/home/RichText%20margin-top.pdf?attredirects...

If so you will probably have to do some more work retaining some of the other style attributes that can be added to a <p> element.

You might also be able to use the span objects, which support a limited set of rich text formatting.  There a sample here, Adobe LiveCycle Designer Cookbooks by BR001: Programmatically updating Rich Text (or xHTML)

Is this the sort of thing you are trying to do?

Regards

Bruce