PDF Editing Issues

How to Add a Sequential Tracking Number to an Acrobat PDF Form

Camila MilosovichCamila Milosovich Nov 2, 2026 869 views

Question details

The user needs to automatically generate and assign sequential tracking numbers to a PDF form while ensuring the assigned number is preserved in saved copies.

How to Add a Sequential Tracking Number to an Acrobat PDF Form
Product
Adobe Acrobat PDF
Device & OS
not provided
Scenario
Creating a dynamic PDF form that requires unique, auto-incrementing tracking numbers (e.g., invoices, receipts, or application forms) for record-keeping.
Observed behavior
The PDF form currently lacks a built-in mechanism to automatically increment tracking numbers each time a new copy is generated and saved.
Before you start

Ensure that your PDF form already includes a designated text field to display the tracking number, and that you have access to the JavaScript editing tools in your PDF application.

Solution 1Recommended

Use Document JavaScript to Generate Sequential Numbers

You can add a custom JavaScript function at the document level to automatically initialize and increment the tracking number each time the form is used.

By leveraging Document JavaScript, the PDF can automatically calculate the next sequential number based on the current field value. This ensures each saved copy receives a unique tracking identifier.

1
Access Document JavaScripts

Open your PDF form in Adobe Acrobat or your preferred advanced PDF editor, and navigate to the Document JavaScripts settings.

2
Create a New Script

In the script name field, enter an unused name for your script, such as 'init', and click the 'Add' button.

3
Prepare the Editor

When the JavaScript editor window opens, highlight and delete the default generated function definition so the window is completely blank.

4
Insert the Tracking Script

Add your custom tracking-number script. The script should initialize your specific text field to a starting number (like 0001) and use the command util.printf("%04d", Number(f.value) + 1) to generate the subsequent number.

5
Save the Form

Save the PDF document. The script will now execute and preserve the newly generated sequential number in your saved copies.

Use Document JavaScript to Generate Sequential Numbers
Understanding the Script Format: The '%04d' parameter in the script guarantees that the generated number is formatted with leading zeros to maintain a four-digit length (e.g., 0001, 0002).
Edit PDF Forms Easily

Manage and Edit PDF Forms with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to easily view, fill out, and manage interactive PDF forms while supporting a wide range of document features.

  1. 1. Open WPS Office: Launch the WPS Office application on your device and click on the 'PDF' tab from the home screen.
  2. 2. Load Your Form: Open your interactive PDF document that contains the tracking number fields.
  3. 3. Fill and Edit: Navigate to the 'Form' tab or simply click on the text fields to input and review your data.
  4. 4. Save Your Copy: Click the 'Save' or 'Save As' button to secure your form entries and preserve the generated tracking numbers.
Easily view, fill, and edit interactive PDF formsHighly compatible with Adobe Acrobat PDF files and Microsoft Office document formatsLightweight application with a highly intuitive user interfaceRobust suite of free basic PDF editing and conversion tools
QA img-9

Frequently Asked Questions

Why is the sequential tracking number not updating when I open the PDF?

If the number fails to update, your PDF viewer may be blocking JavaScript execution for security reasons. Ensure you are using a robust PDF editor that supports Document JavaScript, and check your software's security preferences to allow scripts.

Can I change the starting tracking number to something other than 0001?

Yes. You can modify the initialization value within your Document JavaScript code. Simply change the starting variable in the script to your desired number before saving the form for the very first time.

How do I remove the sequential tracking number script if I no longer need it?

To remove the script, navigate back to the Document JavaScripts menu in your PDF editor, select the script name (e.g., 'init') from the list, and click the 'Delete' button. Save the PDF file to apply the changes.

Does this JavaScript method work on mobile PDF readers?

Most mobile PDF readers have limited or no support for complex Document JavaScript. For the script to accurately read the field value and calculate the next tracking number, the form should ideally be opened and saved on a desktop PDF application.