任何人都可以告诉我哪种中间文件格式可用于将输入文件转换为PDF? 简要说明:我的数据格式为XML'S。这些xmls应映射到一个中间文件,然后用于生成pdf。
答案 0 :(得分:0)
您可以使用PDF::API2或PDF::Create
直接从XML创建PDF示例:
use PDF::Create;
# initialize PDF
my $pdf = PDF::Create->new('filename' => 'mypdf.pdf',
'Author' => 'John Doe',
'Title' => 'Sample PDF',
'CreationDate' => [ localtime ], );
# add a A4 sized page
my $a4 = $pdf->new_page('MediaBox' => $pdf->get_page_size('A4'));
# Add a page which inherits its attributes from $a4
my $page = $a4->new_page;
# Prepare a font
my $f1 = $pdf->font('BaseFont' => 'Helvetica');
# Prepare a Table of Content
my $toc = $pdf->new_outline('Title' => 'Title Page', 'Destination' => $page);
# Write some text
$page->stringc($f1, 40, 306, 426, "PDF::Create");
$page->stringc($f1, 20, 306, 396, "version $PDF::Create::VERSION");
$page->stringc($f1, 20, 306, 300, 'by John Doe <john.doe@example.com>');
#close
$pdf->close();