简体   繁体   English

如何使用 XML/XSLT/XSL-FO 转换 Perl 以创建 PDF 文件

[英]How can I conversion Perl to create PDF files using XML/XSLT/XSL-FO

I want to create pdf using XSLT, ApacheFOP use in PERL.我想使用 XSLT 创建 pdf,在 PERL 中使用 ApacheFOP。 Can anyone Help me?谁能帮我?

    use 5.010;
use warnings;
use strict;
use XML::ApacheFOP;
my $Fop = XML::ApacheFOP->new();
$Fop->fop( xml => "math.xml", xsl => "math.xsl", outfile => "temp.pdf" ) or die "cannot create pdf: " . $Fop->errstr;

Error showing in cmd line can't locate XML/ApacheFOP.pm cmd 行中显示的错误找不到 XML/ApacheFOP.pm

This is almost certainly because XML::ApacheFOP isn't installed.这几乎可以肯定是因为XML::ApacheFOP没有安装。 In a comment, you say that you have tried to install the module using cpanm , but it hasn't installed successfully.在评论中,您说您尝试使用cpanm安装模块,但没有成功安装。 It would be useful to see the error messages that are displayed.查看显示的错误消息会很有用。

The SETUP section of the documentation says that you will need FOP installed before installing the module.文档的 SETUP 部分说您需要在安装模块之前安装FOP If you're on Ubuntu, then that might be as easy as running sudo apt-get install fop .如果您使用的是 Ubuntu,那么这可能就像运行sudo apt-get install fop一样简单。 You should then try the module installation again.然后,您应该再次尝试安装模块。 If it still fails, then ask a new question here, making sure to include the text of the error messages you get from cpanm .如果仍然失败,请在此处提出一个新问题,确保包含您从cpanm获得的错误消息的文本。

The error indicates that your perl distro does not include XML::ApacheFOP module.该错误表明您的 perl 发行版不包含XML::ApacheFOP模块。

The module can be installed in several ways:该模块可以通过多种方式安装:

cpan install XML::ApacheFOP

or或者

cpanm XML::ApacheFOP

or或者

perl -MCPAN -e install XML::ApacheFOP

or download module extract it and run makefile.或下载模块解压并运行 makefile。

It was pointed out that this particular module has java as pre-requisite and should be installed as well.有人指出,此特定模块具有java作为先决条件,也应安装。

How to install CPAN modules如何安装 CPAN 模块

FAQ installing CPAN perl modules 安装 CPAN perl 模块的常见问题

How to install perl modules 如何安装 perl 模块

What's the easiest way to install perl module? 安装 perl 模块最简单的方法是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM