[ubuntu-it] Tagliare altezza di un pdf

Gabriel Rota gabriel.rota a gmail.com
Dom 2 Mar 2014 10:52:46 UTC


Ho controllato meglio.
Più precisamente ho usato questo.
Per comodità provo ad allegartelo.

cat pdf_split_A4_to_A5.pl
#!/usr/bin/env perl
use strict; use warnings;
use PDF::API2;

my $filename = shift || 'test.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.split.$2/;
$newpdf->saveas($newfilename);

__END__
-------------- parte successiva --------------
Un allegato HTML è stato rimosso...
URL: <https://lists.ubuntu.com/archives/ubuntu-it/attachments/20140302/f7156628/attachment-0001.html>
-------------- parte successiva --------------
Un allegato non testuale è stato rimosso....
Nome:        pdf_split_A4_to_A5.pl.tar.gz
Tipo:        application/x-gzip
Dimensione:  442 bytes
Descrizione: non disponibile
URL:         <https://lists.ubuntu.com/archives/ubuntu-it/attachments/20140302/f7156628/attachment-0001.bin>


More information about the ubuntu-it mailing list