Reordering of scanned documents

cat-scan-20100317-214115In case this is useful (for when I next forget and google it myself) when scanning long documents, it’s often more reliable to scan one side at a time, and then run everything through again to scan the reverse. This gives you two PDFs, the odd numbered pages going forwards, and the even numbered pages in reverse. Then it needs to be merged.

If it’s a document that can be posted online, sejda.com does a good job of manipulating pdfs in a bunch of useful ways.

Sometimes, that’s not an option, so the below code adds a menu option to Adobe Acrobat, which will reorder pages when they’re merged to a single PDF.

app.addMenuItem({
cName: "Reorder from Odds then Reversed Evens",
cParent: "Document",
cExec: "OddsThenReversedEvens();",
cEnable: "event.rc = (event.target != null);",
nPos: 0
});

function OddsThenReversedEvens()
{
var t = app.thermometer;
t.duration = this.numPages-1;
var pagecount= this.numPages-1 ;
var target_offset= 0; // pages start at zero
t.begin();
while (target_offset < pagecount) {
this.movePage(pagecount, target_offset);
t.text = ‘Moving page ‘ + (pagecount) + ” to ” + target_offset;
target_offset+= 2; //late page got moved forwards
}
t.end();
}

 

The javascript file can also be downloaded, based on some code from stackoverflow, and here’s a PDF for testing.

05
Oct 2013
POSTED BY
POSTED IN Uncategorized
DISCUSSION 0 Comments
TAGS

Leave a Reply

Your email address will not be published. Required fields are marked *