Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Livecycle Designer - print pages from expanding sections

Avatar

Level 3

Hi,

I have a possibly complex situation. I have a large form divided into about 5 sections. Each section has expanding text fields and information panels. The information panels are there to help the user fill out each field with appropriate information, however, when the form is printed the info panels are set to disappear. This all works fine as it should do.

However, the client has had feedback and sometimes they want to print out single sections. What they have been doing is noting down the page numbers then sending to print only the pages they need. However, this isn't working well enough as once the info panels disappear (which is done automatically) the page numbers no longer coincide with what is being printed.

My solution would be to have a button for each section which would print a span of pages from the start of one field/section to the end of another field/section. Bearing in mind that these points aren't going to be on the same page for each of the filled forms is there a way of doing this?

Apologies here, but in terms of programming I'm a beginner, but hopefully a quick study!

4 Replies

Avatar

Level 10

Hi,

you can determine where a object appears first and also how many pages it spans in the form.

Here's a sample script for a print button that will print all pages where the object "subform1" appears.


var vObj = xfa.resolveNode("form1.page.subform1"),


  vPageStart = xfa.layout.absPage(vObj),


  vPageEnd = vPageStart + xfa.layout.absPageSpan(vObj) - 1;



xfa.host.print(1, vPageStart.toString(), vPageEnd.toString(), 0, 0, 0, 0, 0);


Avatar

Level 3

Radzmar,

Apologies for not responding earlier - been involved in other projects.

Just wanted to say thank you very very much - the code you gave works perfectly.

Many thanks,

Sunil

Avatar

Level 3

Ahh, no, it doesn't quite work.

Throughout a section I have info boxes - these are text boxes wrapped in a subform called info1a, info1b etc. which are set to be hidden pre print - and post print they are set to visible. This works in itself.

However the code above still counts the page numbers within the section prior to the info boxes being hidden - in other words, the info boxes cause the pages to be printed to extend beyond the section as if the info boxes were still there, even though they are not.

If I have two buttons - one to set the visibility of the info boxes to hidden and then click another button to print the section then it works fine, but I can't amalgamate the instructions into one single button.

Here's what I have so far:

Button one - to hide info boxes:

form1.summary.Button1[2]::click - (JavaScript, client)

  this.resolveNode("form1.summary.info1a").presence = "hidden";

this.resolveNode("form1.summary.info1b").presence = "hidden";

this.resolveNode("form1.summary.info1c").presence = "hidden";

Button two - to print the section:

form1.summary.Button1[0]::click - (JavaScript, client)

var vObj = xfa.resolveNode("form1.summary"),

  vPageStart = xfa.layout.absPage(vObj),

  vPageEnd = vPageStart + xfa.layout.absPageSpan(vObj) - 1;

xfa.host.print(1, vPageStart.toString(), vPageEnd.toString(), 0, 0, 0, 0, 0);

I have tried to amalgamate both instructions into one button but this doesn't work:

form1.summary.Button1[0]::click - (JavaScript, client)

  this.resolveNode("form1.summary.info1a").presence = "hidden";

this.resolveNode("form1.summary.info1b").presence = "hidden";

this.resolveNode("form1.summary.info1c").presence = "hidden";

var vObj = xfa.resolveNode("form1.summary"),

  vPageStart = xfa.layout.absPage(vObj),

  vPageEnd = vPageStart + xfa.layout.absPageSpan(vObj) - 1;

xfa.host.print(1, vPageStart.toString(), vPageEnd.toString(), 0, 0, 0, 0, 0);

can anyone help?

Avatar

Level 3

Okay, so after some research I can see that the reason why it's not working is because the functions are working asynchronously ... so irrespective of the order, they all work pretty much at the same time. Problem is, I'm not sure about how to go about splitting them into two sections (hide the info panels FOLLOWED BY printing the section). I think I may need a set time out or a callback function. Can anyone help?