• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
Feb 21, 2019 Feb 21, 2019

Copy link to clipboard

Copied

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.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

631

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
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 22, 2019 Feb 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.

Votes

Translate

Translate
LEGEND ,
Feb 22, 2019 Feb 22, 2019

Copy link to clipboard

Copied

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.

Votes

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
community guidelines
LEGEND ,
Feb 22, 2019 Feb 22, 2019

Copy link to clipboard

Copied

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.

Votes

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
community guidelines
Explorer ,
Feb 22, 2019 Feb 22, 2019

Copy link to clipboard

Copied

I couldn't get this

Votes

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
community guidelines
Explorer ,
Feb 25, 2019 Feb 25, 2019

Copy link to clipboard

Copied

Please suggest me why this line is not working

var p = [10, 6, 2]; var l = p.length;  for (var i =0; i < l; i++) {var s = p; this.deletePages(s)}

where

var p = [10, 6, 2]; var l = p.length;  for (var i =0; i < l; i++) {var s = p; console.println(s)} is working.

I tried to delete 11th 7th and 3rd pages from pdf.

Votes

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
community guidelines
Explorer ,
Feb 25, 2019 Feb 25, 2019

Copy link to clipboard

Copied

LATEST

Sorry it worked. And thanks. If you didn't suggest me REVERSE DELETION, I might take more days to find it.

Votes

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
community guidelines
LEGEND ,
Feb 22, 2019 Feb 22, 2019

Copy link to clipboard

Copied

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

Votes

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
community guidelines
Explorer ,
Feb 22, 2019 Feb 22, 2019

Copy link to clipboard

Copied

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.

Votes

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
community guidelines