Showing posts with label fop. Show all posts
Showing posts with label fop. Show all posts

Thursday, September 11, 2014

Having fun with docbook

For some reason you need to apply the dbfo at different level to apply properties to an element:
<example>
<?dbfo pgwide="1"?> <!-- example level -->
<title>
Full example
</title>
<programlisting language="csharp">
<?dbfo keep-together="auto" ?> <!-- at programlisting level -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="MyCode.cs" parse="text"/></programlisting>
</example>
Reference: http://www.sagehill.net/docbookxsl/PageBreaking.html

Don't ask...

Wednesday, January 27, 2010

fop...

Afterall fop is not that bad. I simply had to update it to the latest version for it to work as expected.

I still need to execute from a deboostrap/sid environment to get MathML 2.0 stuff working

* http://wiki.debian.org/Debootstrap

xmlroff ?

So I discover that fop and dblatex had both issues. I discover this blog:

* http://www.jejik.com/articles/2008/12/docbook_xml_to_pdf_on_debian_lenny/

It mentionned a 3rd contestand: xmlroff.

It seems to work on the PNG example I tried in fop and dblatex.

Hopefully this solution is the solution to go...

What a mess !

Reference:
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567122
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567123

Monday, January 25, 2010

Rendering of MathML with fop

I was having issues with rendering of MathML equation within fop. The actual problem can be reproduce using only jeuclid package. So clearly the problem is at that level.

See for instance the bug report:
* http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=566801

Here is what it looks like on my machine:



Compared to:



Ref:
* http://jeuclid.sourceforge.net/example1.html

Sunday, January 24, 2010

Generating PDF from docbook on Linux (OSS)

My goal was to generate a PDF file from an input docbook file. Sound easy ? Well here are the minimal steps on a lenny/stable system:



$ sudo apt-get install docbook-xsl


and

$ sudo apt-get install -t testing fop libjeuclid-fop-java

You absolutely need fop from testing.

Then to get hyphen working you need to follow instructions from:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526092#20

I used the root solution:

$ cat /etc/fop.conf
FOP_HYPHENATION_PATH=/usr/local/share/java/fop-hyph.jar

and

$ cat ~/.foprc
find_jars jeuclid-core jeuclid-fop

You really need fop from testing otherwise find_jars will not work !

Then I tried on a very simple MathML/docbook example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
[
<!ENTITY % MATHML.prefixed "INCLUDE">
<!ENTITY % MATHML.prefix "mml">
<!ENTITY % equation.content "(alt?, (graphic+|mediaobject+|mml:math))">
<!ENTITY % inlineequation.content
               "(alt?, (inlinegraphic+|inlinemediaobject+|mml:math))">
<!ENTITY % mathml PUBLIC "-//W3C//DTD MathML 2.0//EN"
       "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
%mathml;
]
>
<article>
 <sect1 id="section_Description">
   <title>Description</title>
     <para>
<equation>
<title>My MathML example</title>
<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML">
 <mml:mrow>
   <mml:mo>&sum;</mml:mo>
   <mml:mn>4</mml:mn>
   <mml:mo>+</mml:mo>
   <mml:mi>x</mml:mi>
 </mml:mrow>
</mml:math>
</equation>
     </para>
 </sect1>
</article>

Then execute this way:

$ fop -xsl /usr/share/xml/docbook/stylesheet/nwalsh/fo/docbook.xsl -xml math.xml -pdf math.pdf

Here is what it looks like:






Ref:
  • http://jeuclid.sourceforge.net/jeuclid-fop/index.html
  • https://bugzilla.redhat.com/show_bug.cgi?id=479685
  • http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=440518#42