如何让页眉和页脚不在第一页上打印? 最佳答案 这是一个粗略但有效的例子:
use strict;
use warnings;
use PDF::API2::Simple;
our $PageNo;
my $pdf = PDF::API2::Simple->new(
file => 'file.pdf',
header => \&header,
footer => \&footer,
);
$pdf->add_font('Verdana');
for my $page (1..3) {
$pdf->add_page;
$pdf->text( 'blah' x 300, autoflow => 'on' );
}
$pdf->save;
sub header {
$PageNo++;
return if $PageNo == 1;
shift->text( 'Header text here' );
}
sub footer {
return if $PageNo == 1;
shift->text( 'page: ' . $PageNo, x => 10, y => 10 );
}