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

print range with button

Explorer ,
Feb 19, 2021 Feb 19, 2021

Hi, can I use button with script to make it print range of pages (page 3-6 and 9-11)?

TOPICS
JavaScript
1.3K
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
Community Expert ,
Feb 19, 2021 Feb 19, 2021

You can use this code in button ( keep in mind page 1 is 0, page 2 is 1, page 3 is 2...etc)
var x = this.getPrintParams();
x.printRange = [[2,5], [8,10]];
this.print(x);

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
Community Expert ,
Feb 19, 2021 Feb 19, 2021

You can use this code in button ( keep in mind page 1 is 0, page 2 is 1, page 3 is 2...etc)
var x = this.getPrintParams();
x.printRange = [[2,5], [8,10]];
this.print(x);

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 ,
Nov 06, 2023 Nov 06, 2023

Hi Nesa.

 

I have a problem with this one. I'm trying to print with one mouse up action. Do you have any solution for me? Thanks in advance.

 

var pp = this.getPrintParams();
pp.PrinterName = "";
pp.NumCopies = 1;
pp.printRange = [[0, 2]];
pp.interactive = pp.constants.interactionLevel.silent;
pp.DuplexType = pp.constants.duplexTypes.Simplex;
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);

var pp = this.getPrintParams();
pp.PrinterName = "";
pp.NumCopies = 3;
pp.printRange = [[3, 5]];
pp.interactive = pp.constants.interactionLevel.silent;
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipLongEdge;
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);

var pp = this.getPrintParams();
pp.PrinterName = "";
pp.NumCopies = 4;
pp.printRange = [[6, 7]];
pp.interactive = pp.constants.interactionLevel.silent;
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipLongEdge;
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);

var pp = this.getPrintParams();
pp.PrinterName = "";
pp.NumCopies = 2;
pp.printRange = [[8, 9]];
pp.interactive = pp.constants.interactionLevel.silent;
pp.DuplexType = pp.constants.duplexTypes.Simplex;
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);

var pp = this.getPrintParams();
pp.PrinterName = "";
pp.NumCopies = 1;
pp.printRange = [[10, 11]];
pp.interactive = pp.constants.interactionLevel.silent;
pp.DuplexType = pp.constants.duplexTypes.Simplex;
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);

var pp = this.getPrintParams();
pp.PrinterName = "";
pp.NumCopies = 2;
pp.printRange = [[12, 15]];
pp.interactive = pp.constants.interactionLevel.silent;
pp.DuplexType = pp.constants.duplexTypes.DuplexFlipLongEdge;
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);

var pp = this.getPrintParams();
pp.PrinterName = "";
pp.NumCopies = 1;
pp.printRange = [16];
pp.interactive = pp.constants.interactionLevel.silent;
pp.DuplexType = pp.constants.duplexTypes.Simplex;
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);

var pp = this.getPrintParams();
pp.PrinterName = "";
pp.NumCopies = 1;
pp.printRange = [[17, 18]];
pp.interactive = pp.constants.interactionLevel.silent;
pp.DuplexType = pp.constants.duplexTypes.Simplex;
pp.pageHandling = pp.constants.handling.fit;
this.print(pp);

var pp = this.getPrintParams();
pp.PrinterName = "";
pp.NumCopies = 2;
pp.printRange = [19];
pp.interactive = pp.constants.interactionLevel.silent;
pp.DuplexType = pp.constants.duplexTypes.Simplex;
pp.pageHandling = pp.constants.handling.fit;
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
Community Expert ,
Nov 06, 2023 Nov 06, 2023

Try like this:

function printBothRanges() {
var pp1 = this.getPrintParams();
pp1.PrinterName = "";
pp1.NumCopies = 1;
pp1.printRange = [[0, 2]];
pp1.interactive = pp1.constants.interactionLevel.silent;
pp1.DuplexType = pp1.constants.duplexTypes.Simplex;
pp1.pageHandling = pp1.constants.handling.fit;

var pp2 = this.getPrintParams();
pp2.PrinterName = "";
pp2.NumCopies = 3;
pp2.printRange = [[3, 5]];
pp2.interactive = pp2.constants.interactionLevel.silent;
pp2.DuplexType = pp2.constants.duplexTypes.DuplexFlipLongEdge;
pp2.pageHandling = pp2.constants.handling.fit;

var pp3 = this.getPrintParams();
pp3.PrinterName = "";
pp3.NumCopies = 4;
pp3.printRange = [[6, 7]];
pp3.interactive = pp.constants.interactionLevel.silent;
pp3.DuplexType = pp.constants.duplexTypes.DuplexFlipLongEdge;
pp3.pageHandling = pp.constants.handling.fit;

this.print(pp1);
this.print(pp2);
this.print(pp3);}

printBothRanges();
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 ,
Nov 06, 2023 Nov 06, 2023

Thank you, Nesa. I have problem after page pp6 instead of continuing to print as in my code below it prints all pages at once. With or without "printBothRanges".

 

 

var pp1 = this.getPrintParams();
pp1.PrinterName = "";
pp1.NumCopies = 1;
pp1.printRange = [[0, 2]];
pp1.interactive = pp1.constants.interactionLevel.silent;
pp1.DuplexType = pp1.constants.duplexTypes.Simplex;
pp1.pageHandling = pp1.constants.handling.fit;

var pp2 = this.getPrintParams();
pp2.PrinterName = "";
pp2.NumCopies = 3;
pp2.printRange = [[3, 5]];
pp2.interactive = pp2.constants.interactionLevel.silent;
pp2.DuplexType = pp2.constants.duplexTypes.DuplexFlipLongEdge;
pp2.pageHandling = pp2.constants.handling.fit;

var pp3 = this.getPrintParams();
pp3.PrinterName = "";
pp3.NumCopies = 4;
pp3.printRange = [[6, 7]];
pp3.interactive = pp3.constants.interactionLevel.silent;
pp3.DuplexType = pp3.constants.duplexTypes.DuplexFlipLongEdge;
pp3.pageHandling = pp3.constants.handling.fit;

var pp4 = this.getPrintParams();
pp4.PrinterName = "";
pp4.NumCopies = 2;
pp4.printRange = [[8, 9]];
pp4.interactive = pp4.constants.interactionLevel.silent;
pp4.DuplexType = pp4.constants.duplexTypes.Simplex;
pp4.pageHandling = pp4.constants.handling.fit;

var pp5 = this.getPrintParams();
pp5.PrinterName = "";
pp5.NumCopies = 1;
pp5.printRange = [[10, 11]];
pp5.interactive = pp5.constants.interactionLevel.silent;
pp5.DuplexType = pp5.constants.duplexTypes.Simplex;
pp5.pageHandling = pp5.constants.handling.fit;

var pp6 = this.getPrintParams();
pp6.PrinterName = "";
pp6.NumCopies = 2;
pp6.printRange = [[12, 15]];
pp6.interactive = pp6.constants.interactionLevel.silent;
pp6.DuplexType = pp6.constants.duplexTypes.DuplexFlipLongEdge;
pp6.pageHandling = pp6.constants.handling.fit;

var pp7 = this.getPrintParams();
pp7.PrinterName = "";
pp7.NumCopies = 1;
pp7.printRange = [16];
pp7.interactive = pp7.constants.interactionLevel.silent;
pp7.DuplexType = pp7.constants.duplexTypes.Simplex;
pp7.pageHandling = pp7.constants.handling.fit;

var pp8 = this.getPrintParams();
pp8.PrinterName = "";
pp8.NumCopies = 1;
pp8.printRange = [[17, 18]];
pp8.interactive = pp8.constants.interactionLevel.silent;
pp8.DuplexType = pp8.constants.duplexTypes.Simplex;
pp8.pageHandling = pp8.constants.handling.fit;

var pp9 = this.getPrintParams();
pp9.PrinterName = "";
pp9.NumCopies = 2;
pp9.printRange = [19];
pp9.interactive = pp9.constants.interactionLevel.silent;
pp9.DuplexType = pp9.constants.duplexTypes.Simplex;
pp9.pageHandling = pp9.constants.handling.fit;

this.print(pp1);
this.print(pp2);
this.print(pp3);
this.print(pp4);
this.print(pp5);
this.print(pp6);
this.print(pp7);
this.print(pp8);
this.print(pp9);

 

 

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 ,
Nov 08, 2023 Nov 08, 2023
LATEST

I have found the mistake. Now it works 😃 The problem was single page without two "["  it should be [[16, 16]]

var pp1 = this.getPrintParams();
pp1.PrinterName = "";
pp1.NumCopies = 1;
pp1.printRange = [[0, 2]];
pp1.interactive = pp1.constants.interactionLevel.silent;
pp1.DuplexType = pp1.constants.duplexTypes.Simplex;
pp1.pageHandling = pp1.constants.handling.fit;

var pp2 = this.getPrintParams();
pp2.PrinterName = "";
pp2.NumCopies = 3;
pp2.printRange = [[3, 5]];
pp2.interactive = pp2.constants.interactionLevel.silent;
pp2.DuplexType = pp2.constants.duplexTypes.DuplexFlipLongEdge;
pp2.pageHandling = pp2.constants.handling.fit;

var pp3 = this.getPrintParams();
pp3.PrinterName = "";
pp3.NumCopies = 4;
pp3.printRange = [[6, 7]];
pp3.interactive = pp3.constants.interactionLevel.silent;
pp3.DuplexType = pp3.constants.duplexTypes.DuplexFlipLongEdge;
pp3.pageHandling = pp3.constants.handling.fit;

var pp4 = this.getPrintParams();
pp4.PrinterName = "";
pp4.NumCopies = 2;
pp4.printRange = [[8, 9]];
pp4.interactive = pp4.constants.interactionLevel.silent;
pp4.DuplexType = pp4.constants.duplexTypes.Simplex;
pp4.pageHandling = pp4.constants.handling.fit;

var pp5 = this.getPrintParams();
pp5.PrinterName = "";
pp5.NumCopies = 1;
pp5.printRange = [[10, 11]];
pp5.interactive = pp5.constants.interactionLevel.silent;
pp5.DuplexType = pp5.constants.duplexTypes.Simplex;
pp5.pageHandling = pp5.constants.handling.fit;

var pp6 = this.getPrintParams();
pp6.PrinterName = "";
pp6.NumCopies = 2;
pp6.printRange = [[12, 15]];
pp6.interactive = pp6.constants.interactionLevel.silent;
pp6.DuplexType = pp6.constants.duplexTypes.DuplexFlipLongEdge;
pp6.pageHandling = pp6.constants.handling.fit;

var pp7 = this.getPrintParams();
pp7.PrinterName = "";
pp7.NumCopies = 1;
pp7.printRange = [[16, 16]];
pp7.interactive = pp7.constants.interactionLevel.silent;
pp7.DuplexType = pp7.constants.duplexTypes.Simplex;
pp7.pageHandling = pp7.constants.handling.fit;

var pp8 = this.getPrintParams();
pp8.PrinterName = "";
pp8.NumCopies = 1;
pp8.printRange = [[17, 18]];
pp8.interactive = pp8.constants.interactionLevel.silent;
pp8.DuplexType = pp8.constants.duplexTypes.Simplex;
pp8.pageHandling = pp8.constants.handling.fit;

var pp9 = this.getPrintParams();
pp9.PrinterName = "";
pp9.NumCopies = 2;
pp9.printRange = [[19, 19]];
pp9.interactive = pp9.constants.interactionLevel.silent;
pp9.DuplexType = pp9.constants.duplexTypes.Simplex;
pp9.pageHandling = pp9.constants.handling.fit;

this.print(pp1);
this.print(pp2);
this.print(pp3);
this.print(pp4);
this.print(pp5);
this.print(pp6);
this.print(pp7);
this.print(pp8);
this.print(pp9);

.

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