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

Nov 30, 2018

Copy link to clipboard

Copied

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.

You can use:

this.print({nStart: this.pageNum, nEnd: this.pageNum+1});
TOPICS
Acrobat SDK and JavaScript, Windows

Views

257

Likes

Translate

Translate

Report

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

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

Nov 30, 2018

Copy link to clipboard

Copied

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.

You can use:

this.print({nStart: this.pageNum, nEnd: this.pageNum+1});
TOPICS
Acrobat SDK and JavaScript, Windows

Views

258

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 30, 2018 0
Dec 01, 2018

Copy link to clipboard

Copied

You can use:

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 01, 2018 1
Dec 01, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 01, 2018 2
Dec 01, 2018

Copy link to clipboard

Copied

Thanks, Bernd: worked like a charm!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 01, 2018 1