Trying to create a button to delete pages in a PDF

Jul 16, 2020

Copy link to clipboard

Copied

Hi there! I'm not super familiar with interactive PDFs - It's been a while. 😉

 

I'm working on a doc that I would like to have buttons that would delete sections (multiplate pages) of the document. Essentially it's a collection of forms and we don't always need all of them. So I'm looking for a quick way to hit a button to remove them from the collection. 

 

Do I do that through Javascript? If so, how do I do that? Thank you!!! 

Correct answer by Amal. | Adobe Employee

Hi there

 

Please use the script this.deletePages(0,3); from the first link shared esarlier and see if that works for you.
Note you can change the page range in the scrpit as per your requirement.

 

Regards

Amal

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

105

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

Trying to create a button to delete pages in a PDF

Jul 16, 2020

Copy link to clipboard

Copied

Hi there! I'm not super familiar with interactive PDFs - It's been a while. 😉

 

I'm working on a doc that I would like to have buttons that would delete sections (multiplate pages) of the document. Essentially it's a collection of forms and we don't always need all of them. So I'm looking for a quick way to hit a button to remove them from the collection. 

 

Do I do that through Javascript? If so, how do I do that? Thank you!!! 

Correct answer by Amal. | Adobe Employee

Hi there

 

Please use the script this.deletePages(0,3); from the first link shared esarlier and see if that works for you.
Note you can change the page range in the scrpit as per your requirement.

 

Regards

Amal

TOPICS
Acrobat SDK and JavaScript, PDF forms

Views

106

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
Jul 16, 2020 0
Adobe Employee ,
Jul 16, 2020

Copy link to clipboard

Copied

Hi Codyc

 

We are sorry for the trouble. As described you want to create a button to delete some pages from the PDF form.

 

Would you mind sharing if you have Adobe Acrobat Reader DC  (Freeware Application) or Adobe Acrobat DC (Subscription)?

You may please refer to the similar discussions below and see if that works for you.

 

1. Solved: button to delete pages - Adobe Support Community - 9084910

2. https://acrobatusers.com/forum/forms-acrobat/using-button-delete-pages/ 
Note: The scripts would not work with Adobe Acrobat Reader DC

 

Hope it will help

 

Regards

Amal

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
Reply
Loading...
Jul 16, 2020 1
Jul 16, 2020

Copy link to clipboard

Copied

Hi Amal! 

 

Thanks for the reply! I have the full version of Acrobat and the latest creative cloud subscription. 

 

I've attached a screenshot to show you what I mean - I think this is where I'd put the javascript but I'm not sure what script to copy/paste and how/where I would reference what pages I wanted deleted?

Screen Shot 2020-07-16 at 2.01.11 PM.png

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
Reply
Loading...
Jul 16, 2020 0
Adobe Employee ,
Jul 16, 2020

Copy link to clipboard

Copied

Hi there

 

Please use the script this.deletePages(0,3); from the first link shared esarlier and see if that works for you.
Note you can change the page range in the scrpit as per your requirement.

 

Regards

Amal

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
Reply
Loading...
Jul 16, 2020 1
Jul 16, 2020

Copy link to clipboard

Copied

This is great Amal! I put it in and it worked - what I'm struggling with is the page range, 0,3 

If I have prefixes on my page numbers (example a1, b1, b2) how do I enter those into the script properly? 

Thanks so much for your help!

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
Reply
Loading...
Jul 16, 2020 0
Jul 16, 2020

Copy link to clipboard

Copied

You don't. The script uses physical page numbers only (thankfully), not page labels. And those numbers are 0-based, so 0 means the first page in the file, and 3 means the fourth page. If you want to refer to the last page in the file you can do so using this.numPages-1 .

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
Reply
Loading...
Jul 16, 2020 0
Jul 16, 2020

Copy link to clipboard

Copied

Thank you that is SUPER helpful! It worked for me! You are the best!!

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
Reply
Loading...
Jul 16, 2020 0