Merge odd and even pages
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Chris - Tracker Supp, Tracker Supp-Stefan
Merge odd and even pages
Hi PDF-XChange team.
I have buy your fantastic product PDF-XChange PRO for manipulate PDF Files, merge PDF, add sheets, remove sheets, change order of sheets, easy and fast.
I'm trying to make a simple thing. I have a scanner with sheet feeder but as most is not a double side scanner.
Often I need to scan documents printed in double side, I scan first odd pages 1-3-5-7 to a PDF document and after even pages 2-4-6-8 to other PDF document, logical it's the only way for my scanner.
There is a way to make one automatic merge of both documents in correct order 1-2-3-4-5-6-7-8 ?
I can't find this simple and useful option and I proceed to add one document to another and order manually the pages, but now I have a 98 pages document.
Any idea please.
Thanks in advance.
I have buy your fantastic product PDF-XChange PRO for manipulate PDF Files, merge PDF, add sheets, remove sheets, change order of sheets, easy and fast.
I'm trying to make a simple thing. I have a scanner with sheet feeder but as most is not a double side scanner.
Often I need to scan documents printed in double side, I scan first odd pages 1-3-5-7 to a PDF document and after even pages 2-4-6-8 to other PDF document, logical it's the only way for my scanner.
There is a way to make one automatic merge of both documents in correct order 1-2-3-4-5-6-7-8 ?
I can't find this simple and useful option and I proceed to add one document to another and order manually the pages, but now I have a 98 pages document.
Any idea please.
Thanks in advance.
- Tracker Supp-Stefan
- Site Admin
- Posts: 13663
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Merge odd and even pages
Hi Bingen,
I am afraid that the PDF Tools can't do that automatically, but please tell me if both the odd and even pages are in the correct order or if e.g. the odd pages are ordered correctly and the even ones are in reverse order and I will try to provide a JS that you can execute in our Viewer to do the arrangement for you.
Best,
Stefan
I am afraid that the PDF Tools can't do that automatically, but please tell me if both the odd and even pages are in the correct order or if e.g. the odd pages are ordered correctly and the even ones are in reverse order and I will try to provide a JS that you can execute in our Viewer to do the arrangement for you.
Best,
Stefan
Re: Merge odd and even pages
The pages are in correct order because I put the sheets two times on the scanner feeder and this make directly one pdf each time.
First document includes pages 1-3-5-7-9-11-----
Second document includes 2-4-6-8-10-12--------
Thanks Stefan
First document includes pages 1-3-5-7-9-11-----
Second document includes 2-4-6-8-10-12--------
Thanks Stefan
- Tracker Supp-Stefan
- Site Admin
- Posts: 13663
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Merge odd and even pages
Hi Bingen,
Please merge both documents in a file that contains the pages in order
1,3,5,7,...,2,4,6,...
The pages could be either odd or even number in total, but the odd pages should be first and more or equal the even pages for the below to work properly.
Then once you have all the pages in a single file - open it in our Viewer and press Ctrl-J to open the JavaScript console.
In it copy and paste this code: then press the green triangle to execute it, and your pages should now be ordered properly.
All that's left now is to save the document with the reordered pages.
Best,
Stefan
Please merge both documents in a file that contains the pages in order
1,3,5,7,...,2,4,6,...
The pages could be either odd or even number in total, but the odd pages should be first and more or equal the even pages for the below to work properly.
Then once you have all the pages in a single file - open it in our Viewer and press Ctrl-J to open the JavaScript console.
In it copy and paste this code:
Code: Select all
for (i = 0; i < ((this.numPages - 1)/2); i++)
{
this.movePage(Math.ceil(this.numPages/2)+i,2*i);
}
All that's left now is to save the document with the reordered pages.
Best,
Stefan
Re: Merge odd and even pages
Ok, it works correctly but it's a bit complicated.
I am thinking how to explain to my clients that I have installed too your application.
There is a way to put any plugin or any other method for appears a new option in Document menu by example.
Thanks a lot.
I am thinking how to explain to my clients that I have installed too your application.

There is a way to put any plugin or any other method for appears a new option in Document menu by example.
Thanks a lot.
- Tracker Supp-Stefan
- Site Admin
- Posts: 13663
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Merge odd and even pages
Glad to hear it's working Bingen,
And once you get used to it - it's basically just merging the two documents, executing the JS code letting it do the page rearrangement for you, and then save the file.
When creating/modifying PDF files with our Viewer the PDF Producer entry in the document info will be updated to reflect that, and anyone (even using a third party PDF reader) will be able to check and see this information.
Otherwise if you wish to popularize our products - you can e.g. include a mention of them in your mail signature
Best,
Stefan
And once you get used to it - it's basically just merging the two documents, executing the JS code letting it do the page rearrangement for you, and then save the file.
When creating/modifying PDF files with our Viewer the PDF Producer entry in the document info will be updated to reflect that, and anyone (even using a third party PDF reader) will be able to check and see this information.
Otherwise if you wish to popularize our products - you can e.g. include a mention of them in your mail signature

Best,
Stefan
Re: Merge odd and even pages
We are software developers and we are installing your free viewer to all our clients and installing the pro version to someone interested in manage their Pdf files.
This option for merge odd and even pages is a suggestion of a new client imperative before buy the pro version.
Is for that I need to simplify this option integrating in a menu or button, can be in a newer version of your product?
Thanks Stefan.
This option for merge odd and even pages is a suggestion of a new client imperative before buy the pro version.
Is for that I need to simplify this option integrating in a menu or button, can be in a newer version of your product?
Thanks Stefan.
- Tracker Supp-Stefan
- Site Admin
- Posts: 13663
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Merge odd and even pages
Hi Bingen,
Thanks for the clarification. I thought you need this for yourself.
Unfortunately the current Viewer's interface can't be controlled via Code, but V3 due for release very soon (and the SDKs for it following in the new year) will allow you to create e.g. plug-ins that your customers would be able to install and use from the Viewer's interface.
But for now the above JS is the only page rearrangement method available.
Best,
Stefan
Thanks for the clarification. I thought you need this for yourself.
Unfortunately the current Viewer's interface can't be controlled via Code, but V3 due for release very soon (and the SDKs for it following in the new year) will allow you to create e.g. plug-ins that your customers would be able to install and use from the Viewer's interface.
But for now the above JS is the only page rearrangement method available.
Best,
Stefan
Re: Merge odd and even pages
When trying to use to above script in PDF Xchange editor 7.324.3, I only get an "undefinde" message.
What's missing?
What's missing?
- Tracker Supp-Stefan
- Site Admin
- Posts: 13663
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Merge odd and even pages
Hello Mattes57,
This does not mean that nothing happened - it just means that the scrypt didn't have anything else to output to the console (the window where you see this "Undefined" message).
Please do check your document - and you will see that the script has been executed and the pages rearranged accordingly.
Regards,
Stefan
This does not mean that nothing happened - it just means that the scrypt didn't have anything else to output to the console (the window where you see this "Undefined" message).
Please do check your document - and you will see that the script has been executed and the pages rearranged accordingly.
Regards,
Stefan
Re: Merge odd and even pages
Thanks. Indeed, it worked fine.
Nevertheless, the message is irritating. Thanks for clarification.
So, I've added these lines after the above mentioned code to remember:
Nevertheless, the message is irritating. Thanks for clarification.
So, I've added these lines after the above mentioned code to remember:

Code: Select all
console.clear(); console.show();
console.println("Done!");
console.println("Please ignore the following \"undefined\" message...");
- Tracker Supp-Stefan
- Site Admin
- Posts: 13663
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact: