Copy link to clipboard
Copied
I have a four-page editable pdf form. Two of the pages may or may not (conditionally) need to be printed (based upon the state of two checkboxes on the second page).
I am looking for a code snippet example of how to print non-sequential pages – I do want to display the print dialog for the user.
PSEUDO CODE:
If Check Box 1 = ‘Yes’ AND Check Box 2 = ‘Yes’ THEN Print Pages 2 through 4
ELSE
If Check Box 1 = ‘Yes’ AND Check Box 2 = ‘No’ THEN Print Pages 2 AND 3
ELSE
If Check Box 1 = ‘No’ AND Check Box 2 = ‘Yes’ THEN Print Pages 2 AND 4
ELSE
If Check Box 1 = ‘No’ AND Check Box 2 = ‘No’ THEN Print Page 2
Thank you in advance
Copy link to clipboard
Copied
I FIGURED IT OUT MYSELF. THANKS
var CB1 = this.getField("Check Box1").value;
var CB2 = this.getField("Check Box2").value;
var pp = this.getPrintParams();
var printRange = [];
printRange.push([1,1]); // print page 2
if (CB1 == "Yes") printRange.push([2,2]); // print page 3
if (CB2 == "Yes") printRange.push([3,3]); // print page 4
pp.printRange = printRange;
this.print(pp);
Copy link to clipboard
Copied
I FIGURED IT OUT MYSELF. THANKS
var CB1 = this.getField("Check Box1").value;
var CB2 = this.getField("Check Box2").value;
var pp = this.getPrintParams();
var printRange = [];
printRange.push([1,1]); // print page 2
if (CB1 == "Yes") printRange.push([2,2]); // print page 3
if (CB2 == "Yes") printRange.push([3,3]); // print page 4
pp.printRange = printRange;
this.print(pp);

