Skip to main content
Known Participant
May 30, 2017
Answered

button to delete pages

  • May 30, 2017
  • 2 replies
  • 6958 views

In Acrobat XI, I want a button to delete 4 pages.

Scenario, an 8 page PDF, first 4 pages are instructions. Once the form is complete, the user can click the button and the pages 1 to 4 will delete. Leaving you only the 4 remaining form pages.

I did have something before,...still looking.

This topic has been closed for replies.
Correct answer JR Boulay

Yes, Reader XI and DC can spawn pages and can delete pages that have been spawned, even if they where spawned in a previous session.

2 replies

Participant
April 1, 2021

Is there a script that I can use to delete the current page (regardless of page number) and the next 1 or 2 pages after it?

Any help would be appreciated!

 

Also, is there a way to get my TOC to update automatically if a portion of my form is deleted because it no longer applies? (ie. instructions for a bread maker on page 22 and 23 - person doesn't have a bread maker - clicks a button to delete page 22 and 23, and the table of contents no longer shows "Bread Maker Instructions" - for example)

Thom Parker
Community Expert
Community Expert
April 2, 2021

console and folder level script can delete and insert pages, but not scripts in a document, i.e. form scripts.

Updating TOC pages is not realistic. However, it might be possible to recreate the TOC pages with a scirpt, depending whats required for the graphics, fonts etc.

Take a look at these resources:

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_AcroJS%2FDoc_methods.htm%23TOC_deletePagesbc-20&rhtocid=_6_1_8_23_1_19

https://www.pdfscripting.com/public/Automating-Acrobat.cfm

 

  

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
try67
Community Expert
Community Expert
May 30, 2017

This code will do that:

this.deletePages(0,3);

Note it won't work in Reader, though. Only in Acrobat.

murrjamesAuthor
Known Participant
May 30, 2017

Is there something that will work in Reader. Also will spawning a new page from a template work in reader?

JR Boulay
Community Expert
JR BoulayCommunity ExpertCorrect answer
Community Expert
May 30, 2017

Yes, Reader XI and DC can spawn pages and can delete pages that have been spawned, even if they where spawned in a previous session.

Acrobate du PDF, InDesigner et Photoshopographe