Expand my Community achievements bar.

SOLVED

Optionally print a page

Avatar

Level 7

Hello- In a form I'm working on, the owner of the form wants page 1 instruction page to not print, but they want the user to have the option to print page 1. I've used presence = "hidden" in the prePrint and presence = "visible" in the postPrint event of the page and that works successfully. I'm not sure how to give the user the option to print.

Thanks,

MDawn

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

I find that when dealing with the relevant property, you also need to pair this with the presence property. For example:

if (this.rawValue == 0) {

     page1.presence = "visible";

     page1.relevant = "-print";

}

else {

     page1.relevant = ""; // clear relevant property

     page1.presence = "visible";

}

Another option would be to use the presence property only:

if (this.rawValue == 0) {

page1.presence = "hidden";

}

else {

page1.presence = "visible";

}

And then in the postPrint event, show page1 again:

page1.presence = "visible";

See the example here: http://assure.ly/h7whb8.

Hope that helps,

Niall

View solution in original post

6 Replies

Avatar

Level 7

Hi,

Here is the scripting method you would incorporate into a complete scrpt:

Reference_Syntax.relevant = "+print";  //prints regardless of "presence" property

Reference_Syntax.relevant = "-print";   //does not print regardless of "presence" property

Good luck!

Stephen

Avatar

Level 4

Put a check box on the instruction sheet, then in the change event of the check box, set:

Reference_Syntax.relevant = "+print";

or

Reference_Syntax.relevant = "-print"; 

depending on whether the box is checked (you can set the .relevant of an entire page). Using .relevant is better than .presence, as it prevents (or allows... -print/+print) the page from printing, but doesn't hide the page on screen, so there is no flicker while it's printing.

If you need the actual code, just let me know, but this should be enough to get you going.

- Scott

Avatar

Level 7

Which event would I place this on?

Margaret Dawn

Avatar

Level 7

I put this script in the prePrint event of the page that I want to have the option of printing or not.

if

(this.rawValue == 0){

page1.relevant

="-print";

}

else

{

page1.relevant

="+print";

}

The content of the page is not appearing, however, the page is printing with just the header. How can I have no page print?

Thanks,

MDawn

Avatar

Correct answer by
Level 10

Hi,

I find that when dealing with the relevant property, you also need to pair this with the presence property. For example:

if (this.rawValue == 0) {

     page1.presence = "visible";

     page1.relevant = "-print";

}

else {

     page1.relevant = ""; // clear relevant property

     page1.presence = "visible";

}

Another option would be to use the presence property only:

if (this.rawValue == 0) {

page1.presence = "hidden";

}

else {

page1.presence = "visible";

}

And then in the postPrint event, show page1 again:

page1.presence = "visible";

See the example here: http://assure.ly/h7whb8.

Hope that helps,

Niall

Avatar

Level 7

That worked. It's doing exactly what I needed. Thanks,

MDawn