Skip to main content
Participating Frequently
February 22, 2019
Answered

Deleting PDF pages listed in excel using javascript, Feeding javascript input from excel or other source

  • February 22, 2019
  • 3 replies
  • 1106 views

Hello everyone, I have about 400 page pdfs. I need to delete (20, 21, 100, 150, 300.... pages) some random pages. Page numbers to be deleted are listed in excel. Can I delete those pages with one shot using any script. Or can I delete those pages using bookmark which is one character lengthier than the others. i.e the page need to be deleted having bookmark one additional character comparing to pages which need to retain. Using the bkm length or using the list in excel... any way it is good to me.

This topic has been closed for replies.
Correct answer Test Screen Name

Oh, really, important tip. Run the commands in REVERSE ORDER of page number.

Why? Example. I have to delete page 2 and page 8.

So I delete page 2. Then I delete page 8. Unfortunately, once page 2 was deleted, the eighth page was the original page 9. So you've deleted, in fact, page 2 and page 9.

Doesn't happen if you first delete page 8, then page 2.

3 replies

Legend
February 22, 2019

That's a pity. What bit can't you get? If you aren't already a programmer, you have a lot to learn.

Participating Frequently
February 22, 2019

Yea I am not a programmer. But I have coded my need with some own trail and errors. I could not get REVERSE ORDER at first. By reading it again I got it. I am sure if I do some study on this.deletePages and doc.deletePages then I will get my need.

Test Screen NameCorrect answer
Legend
February 22, 2019

Oh, really, important tip. Run the commands in REVERSE ORDER of page number.

Why? Example. I have to delete page 2 and page 8.

So I delete page 2. Then I delete page 8. Unfortunately, once page 2 was deleted, the eighth page was the original page 9. So you've deleted, in fact, page 2 and page 9.

Doesn't happen if you first delete page 8, then page 2.

Participating Frequently
February 22, 2019

I couldn't get this

Legend
February 22, 2019

One way: you can generate a doc.DeletePages call for each page to delete (that is, automate writing code).

Then run the code e.g. by pasting into the JavaScript console.

Yes, you can use the bookmarks to decide what to do but that's much more advanced and difficult.