Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
In Reader it can't be done anyway.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Acrobat Reader can't extract pages.
Copy link to clipboard
Copied
This code will do it, but as mentioned it won't work in Reader:
this.extractPages(46, 51);
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
What code does you use?
Copy link to clipboard
Copied
Works fine for me. What exact code did you use? Are there error messages in the JS Console when you click it?
Copy link to clipboard
Copied
this.extractPages(46, 51);
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
does this code as you posted it, work for you?
this.extractPages(46, 51);
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
You changed your question after I replied... Yes, the code above works for me. No, the numbers do not represent non-sequential pages.
Copy link to clipboard
Copied
The code is for sequential pages.
Copy link to clipboard
Copied
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
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more