/ Published in: Perl
Each page is split vertically in two pages. Crop and media views are set accordingly. Text layer should be preserved. Takes a path to a PDF file as argument and produces a cropped PDF in the same location.
Comments
Subscribe to comments
You need to login to post a comment.

I have spent the last few hours learning about Perl and scripting on my Mac to be able to run this script, and I have to say that I was extremely skeptical that I'd be able to figure out anything as an almost complete newbie. Fortunately it didn't take long before I realized that PDF::API2 was a module, which sent me scrambling to figure out how to install those. But, with good instruction on the 'net, I've got this thing up and running. What a great experience and so useful! Thank you for this!
You're welcome. I should have indeed made it clear that one needs PDF::API2...
On the Mac, you can also crop left and then right pages with Preview and re-assemble them with this script
It works nicely for smaller files... but it doesn't seem to work on larger files, for example one with 24 pages didn't work but one with 4 pages worked. The pages all come out blank for the bigger files.
Any idea?
@martienne I used the script on large files (300+ pages) without any problem (the only issue is increase in size). What platform are you running Perl on? Where do your PDFs come from (scan, OCRed scan...)? Do they already have the crop box set?
Hi there,
I would really like to try this code. Someone on the Adobe Forum posted a step to step guide for total beginners (like myself) on how to install Perl Modules (for Mac users). I followed that and it worked fine with no problems. Then they said to fire the script (meaning this one) in order to get this great feature, but this was assuming people knew how to fire scripts. Can someone be so kind to explain to a beginner what to do once I have installed PDF::API2. Thanks a million! Andrea
Thank you very much.
If you have done some left and right cropping in the PDF before, you should change the lines 14 and 21 to: 14. $cropdata[2] = ($cropdata[2] + $cropdata[0]) / 2; 21. $cropdata[0] = ($cropdata[2] + $cropdata[0]) / 2;