perl:删除pdf中的页眉和页脚

perl:删除pdf中的页眉和页脚,perl,Perl,我想删除PDF页眉、页脚,即从文档中裁剪页眉和页脚 我正在使用下面的脚本,但是它已经运行了很长时间(24页PDF) 这是正确的方法吗?长时间是多长?脚本需要15分钟。。。 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

我想删除PDF页眉、页脚,即从文档中裁剪页眉和页脚

我正在使用下面的脚本,但是它已经运行了很长时间(24页PDF)


这是正确的方法吗?

长时间是多长?脚本需要15分钟。。。
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);
  $page->cropbox('480%','10%','50%','620%');  
}