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

Extracting multiple pages by page label

New Here ,
Mar 18, 2019 Mar 18, 2019

Hi

I'm trying to extract single and multiple pages based on pre-defined page label names. Probably as an action.

I understand the basics of extracting pages and page labels but can't tie it all together. Any pointers?

Thanks

TOPICS
Acrobat SDK and JavaScript , Windows
722
Translate
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
Community Expert ,
Mar 18, 2019 Mar 18, 2019

You need to better explain the situation. What are the labels in your file and how do they relate to the way you want to extract the pages?

Translate
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
New Here ,
Mar 18, 2019 Mar 18, 2019

The labels are various page labels. Some are numbers, some are letters and numbers eg. A200.

I want to extract specific pages from a list of page labels and save them as new files.

Hope that makes sense.

Translate
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
Community Expert ,
Mar 18, 2019 Mar 18, 2019

Where is this list coming from?

Translate
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
New Here ,
Mar 18, 2019 Mar 18, 2019

I have a list of page labels. They could be put into the code by hand.

Translate
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
Community Expert ,
Mar 18, 2019 Mar 18, 2019

So you have a list of page labels and you want to find the matching pages and extract them as new files, saving them using the label names?

Translate
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
New Here ,
Mar 18, 2019 Mar 18, 2019

Yes correct

Translate
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
Community Expert ,
Mar 18, 2019 Mar 18, 2019

You can use something like this:

var names = ["Page 1", "Page 2", "Cover page"];

for (var p=0; p<this.numPages; p++) {

    var pageLabel = this.getPageLabel(p);

    if (names.indexOf(pageLabel)!=-1) {

        this.extractPages(p, p, pageLabel + ".pdf");

    }

}

Translate
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
New Here ,
Mar 18, 2019 Mar 18, 2019

That's great thanks so much.

Would it be possible to do it for a range of pages as well? Eg "Page1 - Page 6". Where those pages run concurrently, so from "Page 1" to "Page 6".

Translate
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
Community Expert ,
Mar 18, 2019 Mar 18, 2019

Yes, but it will require a more complex script, especially if you want to compare each one of them to the list.

Translate
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
New Here ,
Mar 18, 2019 Mar 18, 2019
LATEST

I'll see if I can work out how to put it together.

Thanks so much for your help though. Appreciated.

Translate
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