Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Fixed height scrollable text field that expands when printed?

Avatar

Level 2

Hi all,

I've come accross this before but for the life of me can't recall: any ideas for what is required to set a text box so that the height remains fixed and utilises scroll bars when there is overflowing text, but on printing the document, the text box then expands so that all text is visible and will be printed?

If I recall, it may be a small snippet of JavaScript that is required, working on a print event?

All other elements will be part of a fluid design so that nothing breaks, however it is important that when viewed on-screen, text boxes have a fixed height. Only required to expand on print.

Any suggestions would be much appreciated: I've been on this for hours!

Many thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Have a look at the last page in this example: http://assure.ly/g80MVY

You will see how in the prePrint event we set the minH property for the textfield and on postPrint set it back to a h property.

Hope that helps,

Niall

View solution in original post

12 Replies

Avatar

Correct answer by
Level 10

Hi,

Have a look at the last page in this example: http://assure.ly/g80MVY

You will see how in the prePrint event we set the minH property for the textfield and on postPrint set it back to a h property.

Hope that helps,

Niall

Avatar

Level 2

Niall: if there was such a thing as a LiveCycle deity you would be it. Thanks very much again!

Avatar

Level 2

Hi Niall,

Hope you don't mind - thought you'd probably be the first port of call!

Would there be a way to apply this type of behaviour to other aspects of controlling appearance?

Just as I'm needing to do the previous, I'm finding that lengthy repeated subforms look disperate when broken over two pages:I'm currently needing to have them break so that, similar to the previous, everything is nice and flexible so that when the text boxes expand prior to printing, all is visible; however for on-screen viewing, ideally I'd like them to not break.

I'm wondering: can a subform be set not to break over a page, but prior to printing, a break kicks in?

Many thanks indeed

Avatar

Level 10

Hi,

I have just tried this, and you could try the following prePrint:

this.keep.intact = "none";

and this in the postPrint:

this.keep.intact = "contentArea";

Hope that helps,

Niall

Avatar

Level 2

Hi Niall,

Thanks for that one. Boy do I have a lot to get my head round!

Quick one on your earlier suggestion for pre-print expanding text boxes: I can see that a specified height is given ("1.25in"), which means that even text boxes with nothing in them all get indescriminately expanded to that dimension on pre-print. The question is, is it possible to expand a text box on pre-print, but only if the content overflows? So, if the content fits, leave intact; but if the content overflows, expand box's height to it. Something similar to the CSS rule 'height: 100%'?

Thanks very much

Avatar

Level 4

I tried looking at the example and apply it for widening a box on printing.  I used minW and w, but I didn't have any luck.  I have a table in which I have I remove row button at the end of the row that is hidden for printing.  I was hoping I could make the column next to the button just expand to cover the space during printing, but it won't respond.  Is there any way that I can do that?

Thanks!

Avatar

Level 10

Hi,

If it is a Table with repeating rows, you would need to loop through each row and change the width property individually. If you have a look at this Table example, you will see how I am changing the presence property of buttons within the row. You would need a similar approach. http://assure.ly/gk8Q7a.

Alternatively, you could try this.w = "2in"; in the prePrint event of the field. Last page of this example for height http://assure.ly/g80MVY.

Hope that helps,

Niall

Avatar

Level 4

It didn't seem to do anything and that is what I had tried earlier.  I have a an add a row and a remove a row button.  Is that going to be causing me problems?  I've attached a sample of my form.  I've already set the add and remove buttons to hide on printing, I'd just like the next column over from the remove button to expand to the margin on print.

https://acrobat.com/#d=M1dT20nCzc6MssGBd7AajQ

Avatar

Level 10

Hi,

I don't think that this is going to be easily achieved.

The best I got was by wrapping the object in a western flowed subform. While this allows the object to increase in width (prePrint), The incease was split on both sides.

https://acrobat.com/#d=G3DkwWp*aw7JcjcaN*JElA.

Sorry,

Niall

Avatar

Level 4

That's ok.  Thanks for trying!

Avatar

Level 5

You are just missing the column widths. You need to set them on pre and post as well

responsibilities.columnWidths = "165.1mm 1.5in 0mm";

on the pre post and

responsibilities.columnWidths = "165.1mm 1.25in 6.35mm";

on the post event

Avatar

Level 4

Thank you so much!  It's working great!