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

Consecutive numbering when using templates

Explorer ,
Mar 23, 2020 Mar 23, 2020

Copy link to clipboard

Copied

Hello together,

I'm currently creating a form in which following pages can be spawned by templates.
For this I need consecutive numbers on the newly created pages which are aligned with the last number of the previous page.
I also have a plan how I want to do this. But I need the prefix of the previous page. How to determine the prefix of the current page I have found out. But how do I determine the prefix of the previous page?

"

var prefix = "";
var re = /(.+\.)(.+)/g;
var res = re.exec(event.target.name);
if (res != null)
{
  prefix = res[1];
}

"

Thanks in advance for helping.

TOPICS
Acrobat SDK and JavaScript

Views

195

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
community guidelines
Community Expert ,
Mar 23, 2020 Mar 23, 2020

Copy link to clipboard

Copied

LATEST

First, the prefix is always the number of the page where the template is spawned. So if it's spawned on page 25, the prefix is "P25".  

So, there are several options for determining the prefix of the previous page.

 

1) If pages are created consecutively, then the previous prefix is just the previous page number. 

2)  You're script is creating the pages, so use a hidden field to track the numbers

3) Search all the field names to find all instances of the template, then workout which one is previous to the one on the current page.  

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

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
community guidelines