Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Custom Print Buttton

DKinsley
Level 9
Level 9

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)?

1 Accepted Solution
Magus069
Correct answer by
Level 10
Level 10

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!

View solution in original post

7 Replies
Magus069
Correct answer by
Level 10
Level 10

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!

View solution in original post

DKinsley
Level 9
Level 9

So simple... it's genius!

Thank you so much!

DKinsley
Level 9
Level 9

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.

Magus069
Level 10
Level 10

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.

DKinsley
Level 9
Level 9

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.

Magus069
Level 10
Level 10

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.

DKinsley
Level 9
Level 9

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";