Link to home
Start Free TrialLog in
Avatar of Software Programmer
Software Programmer

asked on

How to split into individual or reorder the pages in to Single PDF

How to split into individual or reorder if the page numbers are as follows

Have a PDF in the following sequence

1st - 46th page on the left & 1st page on the right

2nd - 2nd page on the left and 45th page on the right

3rd - 44th page on the left and 3rd page on the right

4th - 4th page on the left and 43rd page on the right

I want the PDF to be converted into the sequential order

1, 2, 3, 4, 5

I am having Adobe Acrobat DC.

Please let me know how to convert this PDF to the sequential pages into a SINGLE PDF file.

If Single PDF file with all the pages in sequential is not possible, atleast need a way to split to individual files with correct sequence number of PDF files. so that we can re-join them again.
SOLUTION
Avatar of John
John
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of coolutils works
coolutils works

Are you looking for a batch solution or for a manual one?
Avatar of Joe Winograd
What do you mean by "on the left" and "on the right"? For example, are there two portrait A4 pages on the left side and right side of a landscape A3 page, and what you want to do is split each A3 page into two A4 pages, and then put the split pages in sequential order? If not, please explain "left" and "right".

Also, I don't understand these items in your question:

2nd - 2nd ==> isn't that just one page, i.e., page 2?
4th - 4th ==> isn't that just one page, i.e., page 4?
3rd - 44th page on the left and 3rd page on the right ==> how can the 3rd page be on the left and right?

Regards, Joe
Avatar of Software Programmer

ASKER

it is A4 side...each page has two sides...i.e two pages.....We need to veritically cut the pages and re-order it again..Manual process is cumbersome..Need an automatic way as need to convert huge book pdfs.
I am having Adobe Acrobat DC.
Standard or Pro?
it is A4 side
Do you mean "A4 size"?
We need to vertically cut the pages and re-order it again
I think you're confirming my previous post, but I'm not sure. I think you're saying that it is an A3 page in landscape mode, with the left side and right side each containing an A4 page in portrait mode, like this:

User generated image
I think you want to split the A3 page vertically in the middle to create two A4 pages. Is that right? Regards, Joe
Exactly..Vertically splitting is easy..However re-ordering will take time. Need a automatic way to re-order correctly. Automatica Page number recogniztion also is not possible with Adobe Acrobat.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The above process seems to be cumbersome. I tried the following and it worked. please let me know whether we can simplify this process.....This has 4 stages which i have designed by myself to solve the issue..This is applicable for the above use case only

1. Vertically cut the PDF using A Page Cut Software (or using splitpages.js) or any open source PDF software or online
2. Split the PDF pages into individual files using SAM PDF software which is open source
3. Remember the number of pages in the PDF file and need to give the number of pages in the below program in the total pages variable. by default it would be 32. Run the below program by giving proper folder name as well as the total number of pages so that all the pages will be arranged in a sequential order
4. Merge all the sequential PDF files using SAM PDF software into a single file which is also open source.

import java.io.File;

public class ReorderPdf {

    public static void main(String args[]) {

        String fileNameStartsWith = "_PDFsam_Test-10";
        String dir = "C:\\Individual Pages\\src\\";
        String destDir = "C:\\Individual Pages\\dest\\";
        int totalPages = 32;
        int loops = totalPages/2;
        boolean pickFirst = true;
        int pageNbr1 = 0;
        int pageNbr2 = 0;
        int count = 1;
        for(int i=1; i <= loops; i++) {
            if(pickFirst == true) {
                pageNbr1 = totalPages;
                pageNbr2 = i;
                pickFirst = false;

                totalPages--;
            } else {
                pageNbr1 = i;
                pageNbr2 = totalPages;
                totalPages--;
                pickFirst = true;
            }
            System.out.println("PageNbr 1 "+pageNbr1);
            System.out.println("PageNbr 2 "+pageNbr2);
            File dest = new File(destDir);
            dest.mkdirs();
            File file1 = new File(dir + pageNbr1+fileNameStartsWith+".pdf");
            renameFile(file1, dir, count, fileNameStartsWith, destDir, pageNbr1);
            count++;
            File file2 = new File(dir + pageNbr2+fileNameStartsWith+".pdf");
            renameFile(file2, dir, count, fileNameStartsWith, destDir, pageNbr2);
            count++;

        }

    }


    public static void renameFile(File file, String dir, int count, String fileNameStartsWith, String destDir, int pageNbr) {
        boolean success = new File(dir + count+fileNameStartsWith+".pdf").renameTo(new File(destDir + pageNbr+fileNameStartsWith+"modified"+".pdf"));
        System.out.println("success2 : "+success);
    }

}

please let me know whether we can simplify this process.....
Based on the original question, #a42537658 is an answer and worthy of points. However, later in the thread, the asker clarified that a "Manual process is cumbersome" (that's what #a42537658 is) and that he wants "an automatic way as need to convert huge book pdfs". The automatic way is described in #a42540682, with several solutions offered. Splitting the points evenly between the two experts.
please let me know whether we can simplify this process
Sorry, can't help you with that code...not a language I know.
Can you please forward to PDF and java expert for their views?
I think that the best way for you to proceed is to ask a new question with the relevant Topics, probably Adobe Acrobat, Java, JavaScript, and PDF. When you include the code in the question, wrap it in the BBCode code tags by either using the formatting toolbar (called the BTF here at EE) or typing in the BBCodes manually ([code] and [/code]). This makes the code more readable and easy to select-copy-paste. Good luck with the new question! Regards, Joe