Page 1 of 1

generate pdf with calabash and apache fop

Posted: Tue Dec 16, 2014 9:48 am
by Patrik
Hi,

I'm trying to convert my xslt transformation szenario for generating pdf files to an xproc transformation scenario. However, every pdf file I generated to far could not be opened by any reader cause it is invalid.

Here is my xproc file:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step
xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step"
version="2.0">

<p:input port="source"/>
<p:output port="result">
<p:pipe port="result" step="pdf"/>
</p:output>

<p:xsl-formatter name="pdf">
<p:input port="source">
<p:inline>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="my-page">
<fo:region-body margin="1in"/>
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="my-page">
<fo:flow flow-name="xsl-region-body">
<fo:block>Hello World!</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</p:inline>
</p:input>
<p:input port="parameters">
<p:empty/>
</p:input>
<p:with-option name="href" select="'Test.pdf'"/>
<p:with-option name="content-type" select="'application/pdf'"/>
</p:xsl-formatter>

</p:declare-step>
Adding an fop configuration file with p:with-param (the same I uee for the oxygen built in fop) didn't change anything. So I'm quite lost now.

Does anybody have any working example for generating a pdf with apache fop and calabash as an oxygen transformation scenario?

Thanks and regards,

Patrik

Re: generate pdf with calabash and apache fop

Posted: Wed Dec 17, 2014 3:59 pm
by adrian
Hi,

In case anyone else encounters this, the problem turned out to be the generation of PDF with Calabash 1.0.18 (bundled with Oxygen v16.0) which has a bug in p:xsl-formatter. This bug is fixed in Calabash 1.0.19 and later (Oxygen v16.1 bundles 1.0.20):
Fixed bug where the output file wasn't being properly closed in p:xsl-formatter.

So, the solution is to either upgrade the version of Calabash bundled with Oxygen to 1.0.19 (or later) or upgrade Oxygen to v16.1 (recommended).

Regards,
Adrian