This Perl Script does it. I don't know anything about Perl but managed to get it working on Windows 7. You have to first install the Perl framework and then something called PDF::API2 - a kind of library, I think. You save the file with the extension .pl and simply run it.
This is the script. You can see where I have made changes.
Code:
#!/usr/bin/env perl
use strict; use warnings;
use PDF::API2;
my $filename = shift || 'E:\E-BOOKS\~Travel Guides\Ukraina\ukraine-getting-started.pdf';
my $oldpdf = PDF::API2->open($filename);
my $newpdf = PDF::API2->new;
for my $page_nb (1..$oldpdf->pages) {
my ($page, @cropdata);
$page = $newpdf->importpage($oldpdf, $page_nb);
@cropdata = $page->get_mediabox;
$cropdata[2] /= 2;
$page->cropbox(@cropdata);
$page->trimbox(@cropdata);
$page->mediabox(@cropdata);
$page = $newpdf->importpage($oldpdf, $page_nb);
@cropdata = $page->get_mediabox;
$cropdata[0] = $cropdata[2] / 2;
$page->cropbox(@cropdata);
$page->trimbox(@cropdata);
$page->mediabox(@cropdata);
}
(my $newfilename = $filename) =~ s/(.*)\.(\w+)$/$1.clean.$2/;
$newpdf->saveas('E:\E-BOOKS\~Travel Guides\Ukraina\started.pdf');
__END__
A TOOL WITH A GUI WOULD BE NICE, THOUGH! Anyone knows of one?