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

Button to Export specific pages from PDF

Explorer ,
Jan 27, 2020 Jan 27, 2020

Hello, 

I have a large PDF file containing many different documents (e.g. 20 documents, over 60 pages). 

I need a javascript code that when pressed will export specific pages (p.  42, 46, 47-52) into a new single/combined PDF file loaded in acrobat as a new tab. 

It does NOT need to give a "save as" dialogue box or nor silent save it to the hard drive

 

TOPICS
Create PDFs , Edit and convert PDFs , PDF forms
2.4K
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 ,
Jan 27, 2020 Jan 27, 2020

This is tricky to do if the pages are non-sequential. You would need to create a new document and then insert the page (ranges) into it. Doing so requires a bit of scripting know-how, as well as installing a script file on the local computer.

 

I've actually developed a (paid-for) tool that does just that. You can find it here: http://try67.blogspot.com/2011/04/acrobat-extract-non-sequential-pages.html

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
Explorer ,
Jan 27, 2020 Jan 27, 2020

Hi Try67,

can you clarify what you mean by "installing a script file"?  The computers that will be utilizing this PDF are work computers and installation of applications requires admin login, which average user does not have.

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 ,
Jan 27, 2020 Jan 27, 2020

You would need to place a .js file in a specific folder, either under Acrobat's folder in Program Files or under a user-specific folder in C:\Users\ (assuming you're on a Windows machine). Another option is to run the code from an Action, if you have Acrobat Pro.

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
Explorer ,
Jan 27, 2020 Jan 27, 2020

Accessing the program folders is not possible per user permissions for normal users.

I have acrobat pro, but once the PDF is finalized for the users, they will be accessing the PDF via acrobat reader.  

any other way?

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 ,
Jan 27, 2020 Jan 27, 2020

In Reader it can't be done anyway.

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
Explorer ,
Jan 27, 2020 Jan 27, 2020

since non-sequential pages are not possible, I'm thinking that the 2nd best option is to have 4 separate buttons to extract the 4 documents that need to be extracted.

can you give a code to extract specific pages, example: p 47-52

 

 

 

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 ,
Jan 28, 2020 Jan 28, 2020

Acrobat Reader can't extract 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
Community Expert ,
Jan 28, 2020 Jan 28, 2020

This code will do it, but as mentioned it won't work in Reader:

this.extractPages(46, 51);

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
Explorer ,
Jan 28, 2020 Jan 28, 2020

Hi Try67, I created a button and tried that code for even just 1-page but it isn't working... this is inside Pro, not reader.

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 ,
Jan 28, 2020 Jan 28, 2020

What code does you use?

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 ,
Jan 28, 2020 Jan 28, 2020

Works fine for me. What exact code did you use? Are there error messages in the JS Console when you click it?

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
Explorer ,
Jan 28, 2020 Jan 28, 2020

this.extractPages(46, 51); 

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
Explorer ,
Jan 28, 2020 Jan 28, 2020

wait, are you saying that this.extractPages(46, 51); works for you?  I thought it wasn't working because 46 and 51 are non-sequential. 

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
Explorer ,
Jan 28, 2020 Jan 28, 2020

does this code as you posted it, work for you?

this.extractPages(46, 51);

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 ,
Jan 28, 2020 Jan 28, 2020

No, it doesn't. The two numbers represent the first and last page numbers of the section to extract.

So in the example I gave above it will extract pages 47-52 as a new file, just like you asked for.

The page numbers in the code are zero-based.

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 ,
Jan 28, 2020 Jan 28, 2020

You changed your question after I replied... Yes, the code above works for me. No, the numbers do not represent non-sequential 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
Community Expert ,
Jan 28, 2020 Jan 28, 2020

The code is for sequential 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
Explorer ,
Jan 28, 2020 Jan 28, 2020
LATEST

since extracting pages is limited to sequential order, maybe I can achieve the same thing via different route?  I created a different thread for my new question:

https://community.adobe.com/t5/acrobat/button-to-email-specific-pages/td-p/10887099

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