Skip to main content
atahanhaznedar
Participant
January 6, 2018
Answered

how to separate pages?

  • January 6, 2018
  • 2 replies
  • 1815 views

I have a pdf of a book that my friend of mine sent it to me which is like 300 pages long. But (obviously) he took the photo of every 2 pages in one pdf page but its so hard to read because its really wide is there a way to separate those pages (like cropping) I can screenshot and crop those pages in the paint and make it but Is there another way to do it? thanks:)

This topic has been closed for replies.
Correct answer JR Boulay

In a PDF document cropping is always a mask, nothing is deleted.

This script will duplicate all pages and crop them on the left and on the right.

Copy-paste this script into the JavaScript console of Acrobat Pro, select all, and hit the ENTER key (not Return):

/* Acrobat detection and version detection, requires Acrobat 7 or later version */

if (app.viewerVariation == "Full" && app.formsVersion >= 7)

{

ProcessDocument = app.trustedFunction(function()

{

    // create a new document

    app.beginPriv();

    var newDoc = app.newDoc();

    app.endPriv();

    // get the filename of our current file

    var i = 0;

    while (i < this.numPages)

    {

        newDoc.insertPages( {

            nPage: newDoc.numPages-1,

            cPath: this.path,

            nStart: i

        });

        newDoc.insertPages( {

            nPage: newDoc.numPages-1,

            cPath: this.path,

            nStart: i

        });

        // we did this twice so that we can then split each copy of the page into a left

        // and right half.

        i++;

    }

    if (newDoc.numPages > 1)

    {

        newDoc.deletePages(0);    // this gets rid of the page that was created with the newDoc call.

    }

    // at this point we have a documnent with every page from the source document

    // copied twice

    for (i=0; i<newDoc.numPages; i++)

    {

        // determine the crop box of the page

        var cropRect = newDoc.getPageBox("Crop", i);

        var halfWidth = (cropRect[2]-cropRect[0])/2;

        var cropLeft = new Array();

        cropLeft[0] = cropRect[0];

        cropLeft[1] = cropRect[1];

        cropLeft[2] = cropRect[0] + halfWidth;

        cropLeft[3] = cropRect[3];

        var cropRight = new Array();

        cropRight[0] = cropRect[2] - halfWidth;

        cropRight[1] = cropRect[1];

        cropRight[2] = cropRect[2];

        cropRight[3] = cropRect[3];

        if (i%2 == 0)

        {

      newDoc.setPageBoxes( {

          cBox: "Crop",

          nStart: i,

          rBox: cropLeft

          });

        }

        else

        {

      newDoc.setPageBoxes( {

          cBox: "Crop",

          nStart: i,

          rBox: cropRight

          });

        }

    }

}

ProcessDocument();

}

2 replies

try67
Community Expert
Community Expert
January 6, 2018

If you're interested I've developed a script that does it for you with a single click, and it can be modified to actually remove the data, not just crop it. You can find it here: Custom-made Adobe Scripts: Acrobat -- Split Pages in 2 Parts and Combine to a New File

Bernd Alheit
Community Expert
Community Expert
January 6, 2018

You can crop the pages in Adobe Acrobat.

atahanhaznedar
Participant
January 6, 2018

But with crop, you delete the other part of the page

JR Boulay
Community Expert
JR BoulayCommunity ExpertCorrect answer
Community Expert
January 6, 2018

In a PDF document cropping is always a mask, nothing is deleted.

This script will duplicate all pages and crop them on the left and on the right.

Copy-paste this script into the JavaScript console of Acrobat Pro, select all, and hit the ENTER key (not Return):

/* Acrobat detection and version detection, requires Acrobat 7 or later version */

if (app.viewerVariation == "Full" && app.formsVersion >= 7)

{

ProcessDocument = app.trustedFunction(function()

{

    // create a new document

    app.beginPriv();

    var newDoc = app.newDoc();

    app.endPriv();

    // get the filename of our current file

    var i = 0;

    while (i < this.numPages)

    {

        newDoc.insertPages( {

            nPage: newDoc.numPages-1,

            cPath: this.path,

            nStart: i

        });

        newDoc.insertPages( {

            nPage: newDoc.numPages-1,

            cPath: this.path,

            nStart: i

        });

        // we did this twice so that we can then split each copy of the page into a left

        // and right half.

        i++;

    }

    if (newDoc.numPages > 1)

    {

        newDoc.deletePages(0);    // this gets rid of the page that was created with the newDoc call.

    }

    // at this point we have a documnent with every page from the source document

    // copied twice

    for (i=0; i<newDoc.numPages; i++)

    {

        // determine the crop box of the page

        var cropRect = newDoc.getPageBox("Crop", i);

        var halfWidth = (cropRect[2]-cropRect[0])/2;

        var cropLeft = new Array();

        cropLeft[0] = cropRect[0];

        cropLeft[1] = cropRect[1];

        cropLeft[2] = cropRect[0] + halfWidth;

        cropLeft[3] = cropRect[3];

        var cropRight = new Array();

        cropRight[0] = cropRect[2] - halfWidth;

        cropRight[1] = cropRect[1];

        cropRight[2] = cropRect[2];

        cropRight[3] = cropRect[3];

        if (i%2 == 0)

        {

      newDoc.setPageBoxes( {

          cBox: "Crop",

          nStart: i,

          rBox: cropLeft

          });

        }

        else

        {

      newDoc.setPageBoxes( {

          cBox: "Crop",

          nStart: i,

          rBox: cropRight

          });

        }

    }

}

ProcessDocument();

}

Acrobate du PDF, InDesigner et Photoshopographe