Skip to main content
alexandrav78579103
Participating Frequently
Dec 1, 2018 1:02 AM UTC
Answered

JavaScript for Print button so it will print "this page" and "next page"

I want to start off by saying that I am not a JavaScript writer...

I know the code for printing page ranges, and even the code for printing this page only. But I can't seem to figure out what code to use so that once the button is selected, it will print current (this page) and next page together...?

Any help would be greatly appreciated.

This topic is closed to new replies. Start a new post to keep the conversation going.
Bernd Alheit
Bernd AlheitCorrect answer
Community Expert
Dec 1, 2018 9:19 AM UTC

You can use:

this.print({nStart: this.pageNum, nEnd: this.pageNum+1});

3 replies

alexandrav78579103
Participating Frequently
Dec 1, 2018 12:41 PM UTC

Thanks, Bernd: worked like a charm!

Translate
Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
Dec 1, 2018 9:19 AM UTC

You can use:

this.print({nStart: this.pageNum, nEnd: this.pageNum+1});
Translate
try67
Community Expert
Community Expert
Dec 1, 2018 9:42 AM UTC

I would adjust it slightly, so it doesn't fail when used on the last page of the document:

if (this.pageNum==this.numPages-1) {

    this.print({nStart: this.pageNum});

} else this.print({nStart: this.pageNum, nEnd: this.pageNum+1});

Translate