Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to print non-sequential pages

Explorer ,
Feb 18, 2022 Feb 18, 2022

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

TOPICS
JavaScript , PDF forms , Print and prepress
588
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Explorer ,
Feb 18, 2022 Feb 18, 2022
LATEST

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

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 18, 2022 Feb 18, 2022
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines