Merge odd and even pages

This Forum is for the use of End Users requiring help and assistance for Tracker Software's PDF-Tools Version 4

Moderators: Tracker Support, TrackerSupp-Daniel, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker Supp-Stefan

Post Reply
Bingen
User
Posts: 4
Joined: Thu Dec 06, 2012 10:34 am

Merge odd and even pages

Post by Bingen » Thu Dec 06, 2012 11:12 am

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.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Merge odd and even pages

Post by Tracker Supp-Stefan » Thu Dec 06, 2012 2:06 pm

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

Bingen
User
Posts: 4
Joined: Thu Dec 06, 2012 10:34 am

Re: Merge odd and even pages

Post by Bingen » Thu Dec 06, 2012 6:22 pm

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

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Merge odd and even pages

Post by Tracker Supp-Stefan » Thu Dec 06, 2012 11:11 pm

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:

Code: Select all

for (i = 0; i < ((this.numPages - 1)/2); i++) 
{
  this.movePage(Math.ceil(this.numPages/2)+i,2*i);
}
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

Bingen
User
Posts: 4
Joined: Thu Dec 06, 2012 10:34 am

Re: Merge odd and even pages

Post by Bingen » Fri Dec 07, 2012 11:27 am

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. :shock:

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.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Merge odd and even pages

Post by Tracker Supp-Stefan » Fri Dec 07, 2012 11:56 am

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

Bingen
User
Posts: 4
Joined: Thu Dec 06, 2012 10:34 am

Re: Merge odd and even pages

Post by Bingen » Fri Dec 07, 2012 4:29 pm

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.

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Merge odd and even pages

Post by Tracker Supp-Stefan » Fri Dec 07, 2012 4:35 pm

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

Mattes57
User
Posts: 82
Joined: Tue Aug 12, 2008 4:10 pm
Location: Germany

Re: Merge odd and even pages

Post by Mattes57 » Sat Mar 24, 2018 11:34 am

When trying to use to above script in PDF Xchange editor 7.324.3, I only get an "undefinde" message.
What's missing?

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Merge odd and even pages

Post by Tracker Supp-Stefan » Mon Mar 26, 2018 10:05 am

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

Mattes57
User
Posts: 82
Joined: Tue Aug 12, 2008 4:10 pm
Location: Germany

Re: Merge odd and even pages

Post by Mattes57 » Wed Apr 04, 2018 5:34 pm

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: :D

Code: Select all

console.clear(); console.show();
console.println("Done!");
console.println("Please ignore the following \"undefined\" message...");

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Merge odd and even pages

Post by Tracker Supp-Stefan » Thu Apr 05, 2018 9:04 am

:)

Post Reply