Custom Print Buttton

Avatar

Avatar

DKinsley

Avatar

DKinsley

DKinsley

05-02-2016

My form has two master pages (labeled "Part A" and "Part B". I added all the objects that start at the top of master page 1 in one subform and all the objects that start at the top of master page 2 in another separate subform. Can I script a button to only print the pages created in master page 2 (Part B)?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Magus069

MVP

Total Posts

(val/1000)?string[".0"]}K

Likes

132

Correct Answer

150

Avatar

Magus069

MVP

Total Posts

(val/1000)?string[".0"]}K

Likes

132

Correct Answer

150
Magus069
MVP

05-02-2016

Hi there,

you can go on the prePrint event of PartA and hide that part and then on the postPrint just put it back visible.

Otherwise if you script it in the print button, if the user doesn't use the button but press the Ctrl+P, it will print both parts

Hope this help!

Answers (6)

Answers (6)

Avatar

Avatar

DKinsley

Avatar

DKinsley

DKinsley

08-02-2016

I realized this morning that putting the hide scripts in the prePrint and postPrint events of both buttons made them all run when clicking either print button. I changed the scripts to run before and after the print script in the click evenets (example below) and it works great now!

Thank you for your help!


this.resolveNode("PartA").presence = "hidden";


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


this.resolveNode("Form1.PartB").presence = "visible";


this.resolveNode("Form1.PartA").presence = "visible";


Avatar

Avatar

Magus069

MVP

Total Posts

(val/1000)?string[".0"]}K

Likes

132

Correct Answer

150

Avatar

Magus069

MVP

Total Posts

(val/1000)?string[".0"]}K

Likes

132

Correct Answer

150
Magus069
MVP

05-02-2016

Ahh, well if you rather have a print button for each parts, you better remove the script in prePrint and postPrint and hide the parts needed within the buttons instead.

Avatar

Avatar

DKinsley

Avatar

DKinsley

DKinsley

05-02-2016

The custom print button works fine to print Part A only (button is at the bottom of Part A). When I create the same button at the bottom of Part B, the Part A button stops working correctly and the Part B button only prints the Part A header. Can't figure this out. If i remove the Part B print button, the Part A button goes back to working correctly.

Avatar

Avatar

Magus069

MVP

Total Posts

(val/1000)?string[".0"]}K

Likes

132

Correct Answer

150

Avatar

Magus069

MVP

Total Posts

(val/1000)?string[".0"]}K

Likes

132

Correct Answer

150
Magus069
MVP

05-02-2016

You should instead hide the page in the PDF that is inheriting from the master page,

It is a bit hard to work with master pages on runtime, some errors may occur when it is modified once.

Avatar

Avatar

DKinsley

Avatar

DKinsley

DKinsley

05-02-2016

The problem I am having is when trying to hide Master Page Part A, it does not hide. Even when manually tring to hide it using the Object pallet. I assume I have to hide both the subform Part A and the Master page Part A but it will not work.

Avatar

Avatar

DKinsley

Avatar

DKinsley

DKinsley

05-02-2016

So simple... it's genius!

Thank you so much!