I've examined the features for "Extract Pages" and I've searched through the forums for various combinations of the keywords split, extract, pages, bookmark... but I haven't found a way to to perform the following task. I am using PDF-XChange Editor V5.5 (Build 312.1) on a Windows7 x64 machine.
I have a single 600+ page merged Access report that is saved as a PDF. I've added Bookmarks in groups of 3-5 pages depending on the page count of the merged range. Unfortuntately the report was not designed for me to be able to export it as individual files. Therefore, I need to separate the documents for electronic mailing, giving each range the name of the bookmark.
This is possible with Adobe Pro from at least version 8 forward. Is something like this possible with PDF-XChange? Basically, it would seem an enhancement to the Extract Pages feature which instead of just specifying "Odd only, Even Only, or All, would be to add a Bookmarks option. Then include the ability on the "Output Options" to use the Bookmark as the filename when specifying the Type: Save each page range to separate document.
... or did I miss something?
Split Multi-page PDF at pre-defined Bookmarks
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
JaWoo
- User
- Posts: 2
- Joined: Thu Apr 30, 2015 12:47 pm
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19919
- Joined: Mon Jan 12, 2009 8:07 am
Re: Split Multi-page PDF at pre-defined Bookmarks
Hello JaWoo,
Welcome to our forums. There is no way to do this via the menus, but it's possible with JS in the Editor.
Please open the file you want to split, and make sure it is the active one. Then open the JS console (press Ctrl-J), and copy and paste this code in there:This will go through the top level bookmarks, activate them one by one (from the last to the first), and extract the range of pages between that bookmark and a "last page" variable to the same folder where the original is. For this to work properly it will require that ALL your bookmarks are pointing only to pages inside the same document and not e.g. external files(which is possible in practice). Also if the first bookmarks does not point to the first page, the pages between the first and the first bookmark's page will not be extracted.
Regards,
Stefan
Welcome to our forums. There is no way to do this via the menus, but it's possible with JS in the Editor.
Please open the file you want to split, and make sure it is the active one. Then open the JS console (press Ctrl-J), and copy and paste this code in there:
Code: Select all
if (this.bookmarkRoot.children != null) {
var lastPage = this.numPages;
for (var i = this.bookmarkRoot.children.length-1; i >= 0 ; i--) {
this.bookmarkRoot.children[i].execute();
try {
this.extractPages(
{nStart: this.pageNum,
nEnd: lastPage-1,
cPath: this.bookmarkRoot.children[i].name + ".pdf"}
);
} catch (e) { console.println("Aborted: " + e) }
lastPage = this.pageNum;
}
}Regards,
Stefan
-
JaWoo
- User
- Posts: 2
- Joined: Thu Apr 30, 2015 12:47 pm
Re: Split Multi-page PDF at pre-defined Bookmarks
Thank you, Stefan. I will test this out.
As a follow-up question, how might this be added as a future enhancement? or is it possible to save JavaScript as macros to be called by the program? Thanks for understanding that I am a newbie to PDF-XChange, but I can pick up on things pretty quick.
Jason
As a follow-up question, how might this be added as a future enhancement? or is it possible to save JavaScript as macros to be called by the program? Thanks for understanding that I am a newbie to PDF-XChange, but I can pick up on things pretty quick.
Jason
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19919
- Joined: Mon Jan 12, 2009 8:07 am
Re: Split Multi-page PDF at pre-defined Bookmarks
Hello Jason,
You can actually add a button to the Editor that when clicked will execute the above code and split your file, as with "PrintAllOpenDocuments" here:
https://forum.pdf-xchange.com/ ... 62&t=22821
However the script for splitting by bookmark locations above is not ready to be made in a button - as there are too many things that can go wrong and the script does not check for those.
Regards,
Stefan
You can actually add a button to the Editor that when clicked will execute the above code and split your file, as with "PrintAllOpenDocuments" here:
https://forum.pdf-xchange.com/ ... 62&t=22821
However the script for splitting by bookmark locations above is not ready to be made in a button - as there are too many things that can go wrong and the script does not check for those.
Regards,
Stefan
-
CaptainJohn_W
- User
- Posts: 9
- Joined: Mon Mar 04, 2019 10:51 pm
Re: Split Multi-page PDF at pre-defined Bookmarks
Please add this as a button as a standard feature. I am a paying customer and I have convinced the company I work for to buy 20+ licenses.
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19919
- Joined: Mon Jan 12, 2009 8:07 am
Re: Split Multi-page PDF at pre-defined Bookmarks
Hello CaptainJohn_W,
I will pass this request for consideration but given that this is a niche feature - and we've already suggested an alternative solution - I can not guarantee that this will be approved for inclusion in the Editor for everyone.
Regards,
Stefan
I will pass this request for consideration but given that this is a niche feature - and we've already suggested an alternative solution - I can not guarantee that this will be approved for inclusion in the Editor for everyone.
Regards,
Stefan