Perl 更好的pdf生成文件格式
有谁能告诉我什么样的中间文件格式可用于将输入文件转换为PDF?Perl 更好的pdf生成文件格式,perl,Perl,有谁能告诉我什么样的中间文件格式可用于将输入文件转换为PDF? 简要说明:我有XML格式的数据。这些XML应该映射到一个中间文件,然后用于生成pdf 您可以使用或直接从XML创建PDF 例如: use PDF::Create; # initialize PDF my $pdf = PDF::Create->new('filename' => 'mypdf.pdf', 'Author'
简要说明:我有XML格式的数据。这些XML应该映射到一个中间文件,然后用于生成pdf 您可以使用或直接从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();
使用PDF::Create;
#初始化PDF
my$pdf=pdf::Create->new('filename'=>'mypdf.pdf',
“作者”=>“约翰·多伊”,
'Title'=>'Sample PDF',
“CreationDate”=>[localtime],);
#添加A4大小的页面
my$a4=$pdf->新建页面('MediaBox'=>$pdf->获取页面大小('a4');
#添加从$a4继承属性的页面
my$page=$a4->新建页面;
#准备字体
我的$f1=$pdf->font('BaseFont'=>'Helvetica');
#准备目录
我的$toc=$pdf->new_大纲('Title'=>'标题页','Destination'=>$页);
#写一些文字
$page->stringc($f1,40306426,“PDF::Create”);
$page->stringc($f1,20306396,“版本$PDF::Create::version”);
$page->stringc($f1,20306300,'byjohndoe');
#接近
$pdf->close();
还有ApacheFOP:DocBookXML,简单的docbook。