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

JavaScript for making sequential number field generate new number on printing

Community Beginner ,
Sep 22, 2021 Sep 22, 2021

Copy link to clipboard

Copied

Can you tell me how to edit this script to generate the new number upon printing? Currently it changes on saving and opening. 

var f = this.getField("Tracking Number");if (f.value=="") f.value = "0001";else f.value = util.printf("%04d", (Number(f.value)+1));

 

Thank you! 

TOPICS
Acrobat SDK and JavaScript , Windows

Views

20

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
community guidelines
Community Expert ,
Sep 22, 2021 Sep 22, 2021

Copy link to clipboard

Copied

LATEST

Move the code to the Will Print event of the document, under Tools - JavaScript - Set Document Actions.

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