Button over rides prePrint event

shawnFMU

11-10-2018

Is it possible for a button, on the click event, to over ride a prePrint event?

I have a form that on prePrint event, a page's presence is hidden, so that not even a blank page is printed.

Now I need a button that over rides that   this.presence = "hidden";  command.

Is there a tag to call out?

something like, on click event:

this.prePrint().presence = "visible";

xfa.host.print(1, "0", (xfa.host.numPages-1.toString().....

Thank you in advance

Accepted Solutions (1)

Accepted Solutions (1)

mouslander

15-10-2018

I just tried it with the script below and it worked. I provided a name for the page "Page2" not sure that really matters as long as you use the correct name for the page.

if(CheckBox1.rawValue == "on"){

Page2.presence = "hidden"

}

Remember on the post print action you will need to make the page visible again:

Page2.presence = "visible"

Answers (7)

Answers (7)

mouslander

12-10-2018

you could do that. You could have a hidden field with a value 0 or 1. Add a check box asking if the user wants the page printed if they click yes then the pre-print script is modified to turn on the page, else its off.

shawnFMU

15-10-2018

this is why we shouldn't work late at night... syntax error

Need to remember == means equal rather than just =

mouslander, thank you for double checking!

things work as they should be. All is right with the world again.

shawnFMU

15-10-2018

Well this is strange...

I placed a checkbox field on the page(that hides during print). if I check it, it should allow the page to print.

in the prePrint event for the root sub page, I wrote:

this.presence = "hidden";

if(checkbox.rawValue = "1")

{

this.presence ="visible";

}

when I click "print" without checking anything thing the page shows up.

When I look back, the check box is checked!

I tried:

if(checkbox.rawValue = "0")

{

this.presence ="hidden";

}

if(checkbox.rawValue = "1")

{

this.presence = "visible"

}

same result.

I tried with if...else

same.

It seems that Livecycle is forcing the page to be visible!

Any ideas?!

shawnFMU

12-10-2018

Originally, the client wanted a instruction page to be screen only and completely non-printing(not even a blank page).

So I set hidden in prePrint and visible in postPrint.

Now, they are thinking that maybe there should be a button that allows the user to print the page if they really really want to.

So I though I need an override button would be the trick.

Now I'm thinking set the prePrint event with a statement.. if something is true then hidden, else visible...

and that button trigger a value then the print function.

what does everyone think? (not in the office today to try this out)

mouslander

12-10-2018

That would work in some situations where you just do not want something to print like a button However if the situation is that you do not want to print the page if a user hasn't entered any data then it wont work.

mouslander

12-10-2018

why would you have a preprint that you would need to overwrite? Do you want to reverse the hidden state after printing? If so you could do this on the post print event.