Extracting multiple pages by page label

New Here ,
Mar 18, 2019

Copy link to clipboard

Copied

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, Macintosh, Windows

Views

122

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

Extracting multiple pages by page label

New Here ,
Mar 18, 2019

Copy link to clipboard

Copied

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, Macintosh, Windows

Views

123

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
Mar 18, 2019 0
Most Valuable Participant ,
Mar 18, 2019

Copy link to clipboard

Copied

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?

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

Copy link to clipboard

Copied

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.

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...
Mar 18, 2019 0
Most Valuable Participant ,
Mar 18, 2019

Copy link to clipboard

Copied

Where is this list coming from?

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

Copy link to clipboard

Copied

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

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...
Mar 18, 2019 0
Most Valuable Participant ,
Mar 18, 2019

Copy link to clipboard

Copied

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?

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

Copy link to clipboard

Copied

Yes correct

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...
Mar 18, 2019 0
Most Valuable Participant ,
Mar 18, 2019

Copy link to clipboard

Copied

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");

    }

}

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

Copy link to clipboard

Copied

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".

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...
Mar 18, 2019 0
Most Valuable Participant ,
Mar 18, 2019

Copy link to clipboard

Copied

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

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

Copy link to clipboard

Copied

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

Thanks so much for your help though. Appreciated.

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...
Mar 18, 2019 0