PDF Editing Issues

Renumber PDF Form Pages After Deleting a Spawned Page in Adobe Acrobat

Maira MehtabMaira Mehtab Nov 19, 2026 868 views

Question details

Recalculate page-number fields after deleting a spawned page from a PDF form.

Renumber PDF Form Pages After Deleting a Spawned Page in Adobe Acrobat
Product
Adobe Acrobat PDF forms
Device & OS
not provided
Scenario
A PDF form uses spawned pages and calculation scripts to display page numbers.
Observed behavior
After a spawned page is deleted, its page-number fields need recalculation, but a button on the deleted page cannot reliably run subsequent code.
Before you start

Open the form in Adobe Acrobat and confirm that its page-number fields have calculation scripts. Make sure the control that runs the deletion is on a page that will remain in the document.

Solution 1Recommended

Recalculate the form after deleting the last spawned page

Use a button on a retained page to delete the last spawned page and immediately recalculate the remaining page-number fields.

Deleting only the last spawned page helps avoid duplicate field names when another page is spawned. The deletion and recalculation should run from a control that is not being removed.

1
Open the form editor

In Adobe Acrobat, open the PDF and select Prepare a form. Choose or add a button on a page that will remain after the deletion.

2
Add the button action

Open the button's Properties, select Actions, and add a Run a JavaScript action. In the JavaScript editor, enter: this.deletePages({nStart: this.numPages - 1}); this.calculateNow();

3
Test the numbering

Save the form, leave the form editor, and click the button. Check that the last page was a spawned page and that the remaining page-number fields display the expected numbers.

Recalculate the form after deleting the last spawned page
Check deletion permissions: Page deletion depends on the PDF's permissions and the Acrobat environment. The example deletes the final page, so use it only when that page is the spawned page you intend to remove.
Free Microsoft Office alternative

Work with PDF forms and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDF and Office files. Its format compatibility makes moving everyday documents easier, although it does not fix Acrobat-specific form scripts.

View PDF forms alongside other documentsCompatible with Microsoft Office formats such as DOCX, XLSX, and PPTXFamiliar interface for an easier transition from Microsoft OfficeFree, lightweight tools for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Why should the delete button be on a different page?

A button on the page being deleted may not reliably continue executing after that page is removed. Place the button on a retained page so it can call this.calculateNow() after deletion.

What does this.calculateNow() do?

In an Acrobat JavaScript action, this.calculateNow() triggers form-field calculations. It updates page-number fields only if their calculation scripts are configured to produce the desired numbers.

Can I delete a spawned page from the middle of the form?

You can design a form to handle middle-page deletion, but spawning another page afterward can create duplicate field names. Deleting the last spawned page is the safer approach for the setup described here.

Why might the delete button fail?

Check the PDF's security permissions and whether your Acrobat environment permits page deletion. Also verify that the button action runs JavaScript and targets the intended page.