Highlighted

Please help with custom javascript button: New Form page from template needs to redirect to new page

Community Beginner ,
Nov 10, 2020

Copy link to clipboard

Copied

This script works almost perfect:

 

var pageCount = 0;
var pagePos = 0;
pageCount = this.numPages;
pagePos = pageCount+1;
var b = getTemplate("EVC");
b.spawn({nPage: pagePos, bRename: true, bOverlay: false});

 

I have one issue with this. How to do get the page view to jump to the newly generated page when this same button is clicked? Currently the page view is staying on the same page and then I have to scroll to the next page, so I can't tell if the new page is generated unless I'm watching the page numbers change.

Adobe Community Professional
Correct answer by George_Johnson | Adobe Community Professional

You could set the pageNum property to the newly generated page, which should be the same as pageCount. So you could add the following line of code to the end of your script:

 

pageNum = pageCount;

TOPICS
Acrobat SDK and JavaScript, General troubleshooting, How to, PDF forms

Views

29

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

Please help with custom javascript button: New Form page from template needs to redirect to new page

Community Beginner ,
Nov 10, 2020

Copy link to clipboard

Copied

This script works almost perfect:

 

var pageCount = 0;
var pagePos = 0;
pageCount = this.numPages;
pagePos = pageCount+1;
var b = getTemplate("EVC");
b.spawn({nPage: pagePos, bRename: true, bOverlay: false});

 

I have one issue with this. How to do get the page view to jump to the newly generated page when this same button is clicked? Currently the page view is staying on the same page and then I have to scroll to the next page, so I can't tell if the new page is generated unless I'm watching the page numbers change.

Adobe Community Professional
Correct answer by George_Johnson | Adobe Community Professional

You could set the pageNum property to the newly generated page, which should be the same as pageCount. So you could add the following line of code to the end of your script:

 

pageNum = pageCount;

TOPICS
Acrobat SDK and JavaScript, General troubleshooting, How to, PDF forms

Views

30

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 10, 2020 0
Adobe Community Professional ,
Nov 10, 2020

Copy link to clipboard

Copied

You could set the pageNum property to the newly generated page, which should be the same as pageCount. So you could add the following line of code to the end of your script:

 

pageNum = pageCount;

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...
Nov 10, 2020 1