10 Replies Latest reply on Aug 18, 2008 7:15 AM by (David_W._Grimes)

    deletePages problem...

      I am having a problem deleting the last page in a document...I'm using Acrobat Pro 8...

      For example, I have a 29 page doc, so here are my sequences to delete all but Page 8...

      this.deletePages({nStart:8, nEnd:28});
      this.deletePages({nStart:0, nEnd:6});

      ...keeps throwing an internal error,
      BUT works fine as long as I don't delete the last page...for example:

      this.deletePages({nStart:8, nEnd:27});
      this.deletePages({nStart:0, nEnd:6});

      ...this works great besides leaving the last unwanted page...
      any ideas? Thanks in advance...

      I found this old archived post, but I don't know how to make it work. any help would be appreciated...

      >
      >Here are some of the things to think about when writing this.
      >
      >You will want to delete two ranges of pages: 0 to current-1, and
      >current+1 to last. Remember page numbers are zero-based.
      >
      >Remember that a given range may be empty, and skip the doc.deletePages
      >in this case.
      >
      >If you delete pages 0 to current-1, the first page to delete is no
      >longer page current+1, but page 1. One way around this is to delete
      >the last pages first.
      >
      >Won't work in Reader without Usage Rights.
      >
      >Aandi Inston
      >