generate pdf with calabash and apache fop

Here should go questions about transforming XML with XSLT and FOP.
Patrik
Posts: 216
Location: Hamburg/Germany

generate pdf with calabash and apache fop

Tue Dec 16, 2014 9:48 am

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
adrian
Posts: 2337

Re: generate pdf with calabash and apache fop

Wed Dec 17, 2014 3:59 pm

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
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Return to “XSLT and FOP”

Who is online

Users browsing this forum: No registered users and 1 guest