を使用して PDF のタイトルと作成者のメタデータを追加/上書きするにはどうすればよいCAM::PDF
ですか?
1 に答える
4
私はCAM::PDFの作者です。ライブラリはこの種の編集をサポートしていませんが、次のように内部を掘り下げることで編集できます。
#!perl -w
use strict;
use CAM::PDF;
my $infile = shift || die 'syntax...';
my $outfile = shift || die 'syntax...';
my $pdf = CAM::PDF->new($infile) || die;
my $info = $pdf->getValue($pdf->{trailer}->{Info});
if ($info) {
#use Data::Dumper; print Dumper($info);
my $title = $info->{Title};
if ($title) {
$title->{value} = 'Foo';
# for a proper implementation, we should mark the holder of $info as dirty...
# But cleanoutput ignores dirty flags anyway and writes the whole doc
$pdf->cleanoutput($outfile);
}
}
于 2012-05-07T15:10:33.700 に答える