Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to set multiple Last page placement in a page set

Avatar

Level 2

Problem statement

Form with the 4 subforms named A to D. A turns B on or off, D is only visible when printing.

When viewing the form interactively
I need the following order (number in brackets indicates columns):
When printing the form I need the following order:

A (2)

C (2)

A (2)

C (2)

A(2)

B(1)

C(2)

A(2)

C(2)

D(1)

I can do this just fine with some fancy scripting.

However, the problem is that on the last page must appear a box in the lower right hand corner.
This must appear in the same place no matter which is the last page.


As you see above, sometimes the subform C is the last page and sometimes D.

Of course I have two master pages, MasterTWoColumn and MasterOneColumn and they are applied to the appropriate subforms.

I can create another master page and name it MasterTwoColumn-Last and set the pagination so that the placement is Last page (in Page Set).

On this last master page I put my box and adjust the content areas to allow for it. This works perfectly when viewing and printing subforms A to C.

However, when I need to have subform D as the last page displayed, I really need another Last Master page so that I can adjust the content area to show the box on the last page (which only has one column).

But how to turn off the MasterTwoColumn-Last master page and turn on the MasterOneColumn-Last ?

Something to do with Page Sets perhaps???

5 Replies

Avatar

Level 10

Hi,

Have a look at this example that has script in the layout:ready event of the footer: http://assure.ly/pGOS6t.

Niall

Avatar

Level 2

This looks very helpful, thanks Niall.  This seems like the right track for me to solve my problem.

However it does not quite work when the page layout is two columns.

I actually need to detect when the last subform C is being displayed in the left hand column, then add sufficient space to force it to show in the right hand column (following your suggestion of a spacer subform that has its size set dynamically).

Since the form is flowed, I understand that I have to use xfa.layout.x(this) , instead of this.x. This is ok if I can just get an actual number......

In my tests, I have been unable to discover what is the layout.x value of the spacer form. When using the

     console.println("x = " + xfa.layout.x(this));

it always shows me a value of zero (0).

   I have tried lots of other printlns to show the x value up the tree (this.parent.x, this.parent.parent.x, etc) and it always gives me a zero.

My spacer form is the following relationship to the form object.

     form.printSubForm.footerSubForm.spacerSubform.

    

console.println("x = " + xfa.layout.x(this));
console.println("parent.x frm 0 = " + xfa.layout.x(this.parent, "pt", 0));
console.println("parent.x frm 1= " + xfa.layout.x(this.parent, "pt", 1));
console.println("parent.parent.x frm 0 = " + xfa.layout.x(this.parent.parent, "pt", 0));
console.println("parent.parent.x frm 1 = " + xfa.layout.x(this.parent.parent, "pt", 1));
console.println("parent.parent.parent.x frm 0 = " + xfa.layout.x(this.parent.parent.parent, "pt", 0));
console.println("parent.parent.parent.x frm 1 = " + xfa.layout.x(this.parent.parent.parent, "pt", 1));

Anything else I could try?

Avatar

Level 10

Hi,

I don't think you can get the y property of a subform. In my example I am accessing the y property of a horizontal line and not the subform itself. Because of the flowed layout, the line is always immediately above the subform, so will have the same (or very similar) y coordinate.

Niall

Avatar

Level 2

I was trying to find the x coordinate (not the y) to determine how far to the left that the subform shows.

If there is something else that would tell me if the subform is being displayed in the Left ContentArea or the Right ContentArea, then that would give me the necessary info.

Essentialy, what I need is this:

if (subform shows in the left content area ) then

     add the height of the left content area to the subform

else

     don't add anything

end if

Theoretically this should then ensure that my spacer subform is large enough to force my footer box to show up at the bottom of the right hand col.

Accessing the Y property of the spacer line does indeed work just fine and I can get the footer box to show up in the bottom of the col as desired. Trouble is, sometimes it is the wrong col.

Avatar

Level 10

Hi,

I can't get to Designer for the next while, however if your container is Flowed western style, then a vertical line object to the left of the subform may help give you the x coordinates of the subform. Maybe try the line object to the right of the subform and then subtract the width of the subform in points.

Hope that helps,

Niall