0

For my project, I would like to test XEP and AH Formatter. I like FOP but in some cases it really fails (floats, crop marks, pdf/x standards, etc.) and I need to know some alternatives.

XEP

With XEP I am very close. I have copied all jars into $EXIST_HOME/lib/user and changed the adapter in $EXIST_HOME/conf.xml. Besides, I have uploaded the xep.xml config file into the database.

Testing 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")

It throws:

exerr:ERROR org.exist.dom.persistent.NodeProxy cannot be cast to org.w3c.dom.Node [at line 7, column 13]

AH Formatter

With AH Formatter, I am lost at the moment. It does not include any specific jar file I could copy into $EXIST_HOME/lib/user, or at least it does not seem so. On AH site there is a note about using AH Formatter on a linux machine but this remark does not help in the whole process of including that into eXist.

The installation includes several folders which are all mentioned in the run.sh file, it is much more fragmented app than XEP.

I am testing on Ubuntu Server 14.04 and eXist-db RC01.

Honza Hejzl
  • 874
  • 8
  • 23
  • 1
    The Java interface for AH Formatter is documented at https://www.antennahouse.com/product/ahf66/ahf-java.html. AH Formatter also has a Web Interface option: https://www.antennahouse.com/web-interface/ – Tony Graham Oct 23 '19 at 09:12

2 Answers2

2

While this is an old question, I figured I would post an alternate answer here in case in comes up in searches.

As an alternative, you could install RenderX's EnMasse (or WinMasse on Windows) which gives a SOAP interface to the formatter. Note, this can be run on any machine, it is not even required to be on the eXist server at all. EnMasse provides a SOAP port to submit your FO and get back PDF (or alternate formats). Then it is as easy as building a SOAP message and sending it to the EnMasse server.

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()

In this sample code, it returns base64 encoded PDF but you get the idea, you can use with response-stream-binary() for getting the PDF back.

This can be used in very high performance environments because EnMasse can scale to use many RenderX XEP threads in multiple JVMs, cores, and even different machines.

Kevin Brown
  • 8,805
  • 2
  • 20
  • 38
1

eXist at the moment only supports Apache FOP or RenderX XEP.

@wolfgang-meier previously added support for Antenna House formatter (22 August 2012, git commit: ffda3b7), but he then again removed it on 12 Sept 2012 (git commit: 5a2a0aa) with the comment that it would be moved to a separate project... I cannot actually find the separate project.

If you want to use Antenna House, I would suggest contacting Wolfgang or getting the code from the relevant Git Commits.

Regards the error you have with RenderX XEP, when you get the error exerr:ERROR org.exist.dom.persistent.NodeProxy cannot be cast to org.w3c.dom.Node there should also be an associated stack trace in your $EXIST_HOME/webapp/WEB-INF/logs/exist.log, can you please post the relevant section of that also?

adamretter
  • 3,885
  • 2
  • 23
  • 43
  • That’s interesting. There is no error associated with this. When I try to clean the log and run the test, nothing new there. But some errors emerge if I restart eXist. [Here](ftp://46.28.111.241/exist.log) you can check the log, it is pretty long. There is some error associated with Indexing (despite this, my settings work well when search through files). Except the XEP problem, everything works well. – Honza Hejzl Apr 06 '16 at 08:15
  • Still no progress. I have tried to switch to RC02, which seems to be a bit broken in case of xslfo (I have posted an Issue on GitHub). Aside, I tried to do fresh install of RC01 and upload there my app. It is the same. In the log, there is only the same error regarding the Index but nothing associated with xslfo. – Honza Hejzl Apr 07 '16 at 13:13
  • Sorry what RC02? You should be using either eXist-2.2 or eXist-3.0.RC1. Also I cannot access that log file that you say you uploaded. – adamretter Apr 11 '16 at 03:36
  • Mea culpa, server fault. Now it is there. As for the version, again, I am sorry for unclear information, I meant 3.0.RC2. I was trying to somehow make the FOP 2.1 to work so I tried to use your last build. Thanks for your patient support, it is very worthy. The log file tracks eXist’s run from clean startup, over the XEP test, and to shutdown. – Honza Hejzl Apr 11 '16 at 07:26
  • Ok, here I should correct terms too—I meant nightly build **#ecc4df4**, not 3.0.RC2. – Honza Hejzl Apr 11 '16 at 14:44
  • Okay so with a nightly-build do you have FOP 2.1 working? And is it just XEP that still doesn't work for you? – adamretter Apr 11 '16 at 21:34
  • I am sorry, on Github, the associated report was closed too early (before the correction of names used when reporting). It is here: [https://github.com/eXist-db/exist/issues/966](https://github.com/eXist-db/exist/issues/966). Unfortunately, FOP 2.1 threw this error. With XEP, it is still the same (nothing in the log). Here I am suspicious about my experiences with XEP (none). I am trying test XEP trial version. Don’t know if that could matter. Maybe I don’t have everything set properly. – Honza Hejzl Apr 12 '16 at 06:58
  • @HonzaHejzl Okay I reopened the GitHub issue and responded to you there. – adamretter Apr 13 '16 at 16:05