如何让页眉和页脚不在第一页上打印?
问问题
1395 次
1 回答
2
这是一个粗略但有效的示例:
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 );
}
于 2010-07-01T10:09:21.707 回答