对于我的项目,我想测试XEP和AH Formatter。我喜欢FOP,但在某些情况下它确实失败了(浮标,裁剪标记,pdf / x标准等),我需要知道一些替代方案。
XEP
使用XEP,我非常接近。我已将所有jar复制到$EXIST_HOME/lib/user
并更改了$EXIST_HOME/conf.xml
中的适配器。此外,我已将xep.xml
配置文件上传到数据库中。
测试XQuery:
xquery version "3.0";
declare namespace fo = "http://46.28.111.241:8081/exist/db/apps/bunny/modules/fop";
let $config := doc('/db/apps/bunny/test/xep.xml')
let $fo := doc('/db/apps/bunny/data/test.fo')
let $pdf := xslfo:render($fo, "application/pdf", (), $config)
return response:stream-binary($pdf, "application/pdf", "output.pdf")
它抛出:
exerr:ERROR org.exist.dom.persistent.NodeProxy cannot be cast to org.w3c.dom.Node [at line 7, column 13]
AH Formatter
使用AH Formatter,我现在迷路了。它不包含我可以复制到$EXIST_HOME/lib/user
的任何特定jar文件,或者至少看起来不是这样。在AH网站上有一个关于在Linux机器上使用AH Formatter的说明,但这句话对于将其包含在eXist中的整个过程没有帮助。
安装包括几个文件夹,这些文件夹都在run.sh
文件中提到,它的应用程序比XEP更加分散。
我正在测试Ubuntu Server 14.04和eXist-db RC01。
答案 0 :(得分:2)
虽然这是一个古老的问题,但我想我会在这里发布一个替代答案,以防搜索出现。
作为替代方案,您可以安装RenderX的EnMasse(或Windows上的WinMasse),它为格式化程序提供SOAP接口。请注意,它可以在任何计算机上运行,甚至根本不需要在eXist服务器上。 EnMasse提供了一个SOAP端口,用于提交您的FO并获取PDF(或其他格式)。然后,这就像构建SOAP消息并将其发送到EnMasse服务器一样容易。
xquery version "3.0";
declare namespace fo = "http://www.w3.org/1999/XSL/Format";
(: web address for the EnMasse server :)
let $xepsoap := 'http://www.yourserver.com:6577/fairy'
(: The base for any relative references (if any) -- cannot be empty and does not need to exist at all on the formatting server, just a path to resolve relative references :)
let $in0 := 'c:/foo.xml'
(: The base64 encoded XSL FO :)
let $in1 := util:base64-encode(serialize(doc('/db/EIDO/data/edit/_scratch/sample.fo')/fo:root))
let $soapMessage := <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:fairy="http://www.yourserver.com:6577/fairy">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<fairy:format SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<in0>{$in0}</in0>
<in1>{$in1}</in1>
</fairy:format>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
let $xepout := httpclient:post(xs:anyURI($xepsoap),$soapMessage,false(),<headers/>)
return $xepout//formatReturn/string()
在此示例代码中,它返回base64编码的PDF,但您了解了这一点,可以将其与response-stream-binary()一起使用以获取PDF。
这可以在非常高性能的环境中使用,因为EnMasse可以扩展以在多个JVM,内核甚至不同的机器上使用许多RenderX XEP线程。
答案 1 :(得分:1)
如果您想使用Antenna House,我建议您联系Wolfgang或从相关的Git Commits获取代码。
关注RenderX XEP的错误,当您收到错误exerr:ERROR org.exist.dom.persistent.NodeProxy cannot be cast to org.w3c.dom.Node
时,$EXIST_HOME/webapp/WEB-INF/logs/exist.log
中也应该有一个关联的堆栈跟踪,请您发布相关部分吗?< / p>