class SplitBooklet
{
    /**
     * Default constructor.
     */
    private SplitBooklet()
    {
        // example class should not be instantiated
    }

    public static void main(String[] args) throws IOException
    {<FILL_FUNCTION_BODY>}
    
    private static void usage()
    {
        System.err.println("Usage: java " + SplitBooklet.class.getName() + " <input-pdf> <output-pdf>");
    }
    
}

        if (args.length < 2)
        {
            usage();
            System.exit(-1);
        }
        try (PDDocument document = Loader.loadPDF(new File(args[0]));
             PDDocument outdoc = new PDDocument())
        {
            for (PDPage page : document.getPages())
            {
                PDRectangle cropBoxORIG = page.getCropBox();
                
                // make sure to have new objects
                PDRectangle cropBoxLEFT = new PDRectangle(cropBoxORIG.getCOSArray());
                PDRectangle cropBoxRIGHT = new PDRectangle(cropBoxORIG.getCOSArray());
                
                if (page.getRotation() == 90 || page.getRotation() == 270)
                {
                    cropBoxLEFT.setUpperRightY(cropBoxORIG.getLowerLeftY() + cropBoxORIG.getHeight() / 2);
                    cropBoxRIGHT.setLowerLeftY(cropBoxORIG.getLowerLeftY() + cropBoxORIG.getHeight() / 2);
                }
                else
                {
                    cropBoxLEFT.setUpperRightX(cropBoxORIG.getLowerLeftX() + cropBoxORIG.getWidth() / 2);
                    cropBoxRIGHT.setLowerLeftX(cropBoxORIG.getLowerLeftX() + cropBoxORIG.getWidth() / 2);
                }
                
                if (page.getRotation() == 180 || page.getRotation() == 270)
                {
                    PDPage pageRIGHT = outdoc.importPage(page);
                    pageRIGHT.setCropBox(cropBoxRIGHT);
                    PDPage pageLEFT = outdoc.importPage(page);
                    pageLEFT.setCropBox(cropBoxLEFT);
                }
                else
                {
                    PDPage pageLEFT = outdoc.importPage(page);
                    pageLEFT.setCropBox(cropBoxLEFT);
                    PDPage pageRIGHT = outdoc.importPage(page);
                    pageRIGHT.setCropBox(cropBoxRIGHT);
                }
            }
            outdoc.save(args[1]);
            // closing must be after saving the destination document
        }
    
<no_super_class>