Custom conditional break within content

Magus069

MVP

08-08-2019

HelloW,

Dynamic PDF Form created using Adobe LiveCycle Designer ES4.

Here's my dilemma...

I have numerous subforms; tables; containing text fields and labels, etc... Text fields are expand to fit, multi-line available along with Allow Page Breaks within Content.

I know that when a text field's "Allow Page Breaks within Content" is specified, objects properties will contain "minH" property instead of "h" property.

And for subforms *any placeholders* the property keep->intact will be specified as "contentArea" if not Allowed; and will be specified as "none" if Allowed.

The thing is that allowing page breaks within content may sometime breaks when it's not really convenient.

E.g.: Two to four lines of text is not really necessary to breaks the content.

Anyone have any idea how it would be possible to specifically allow page breaks within content only if the text field contains over a certain amount of lines, or a certain height, and if under that amount it would not breaks the content to the next page.

Any idea is welcome, not really important detail but it would be nice to be able to do so.

Thanks in advance for any suggestions.

Accepted Solutions (1)

Accepted Solutions (1)

radzmar

MVP

09-08-2019

You can use a separate subform with no height ("forceBreakSF") which is set to start alyways on a new page. This subform you place you place in the same subform as the textfield(s) but at the top and then you make it hidden.

Through a script in the layout:ready event of the surrounding subform you control the visibliliy of forceBreakSF:

// create break when text field is higher than 20 mm.

forceBreakSF.presence = xfa.layout.h(textField1, "mm") > 20 ? "visible" : "hidden";

Hope this helps.

Answers (1)

Answers (1)

Magus069

MVP

09-08-2019

Thanks radzmar,

I will test this out next week. But on first thoughts, it might not work because textfields can litterally be anywhere in the form...

I basically don't know what's the height needed for any textfield to reach the next page. But I'll test things out, I might be missing something like knowing if the texfield is only on 1 page or if it breaks to another page. If I am able to know if it breaks to another page, then I could verify the height to see if it's necessary to break or not.

Good stuff thanks. I forgot about the xfa.layout... functions. I might have to use xfa.layout.page with a subform above and below the textfield to know if it breaks and then I'd be verifying the height of the text field.

Unless I can use xfa.layout.page for 1 textfield and it will tell me if it's on 2 different page, but if I remember well it only returns the page of where the object starts.

Anyway,

Thanks for the hint!!