Converting DocBook into PDF

N.J. Thomas njt at ayvali.org
Tue Jun 6 14:07:43 UTC 2006


* Rico <coolzone at io.dk> [2006-06-06 03:41:50 +0200]:
> I am working on a documentation project and needs to convert some
> DocBook files into several formats.
> 
> I have installed "xmlto" amongst others and I can convert the DocBook 
> into XHTML, TXT but not into PDF or PS.

This doesn't really help you with your xmlto problem, but I use the
following toolchain to produce PDF from DocBook

    - write the XML file against the DocBook DTD

    - validate the file with "xmllint --valid --noout foo.xml"
      xmllint is part of libxml2

      (Theoretically, this step is not necessary if you write proper
      XML, but xsltproc does not checks for valid XML (only well
      formed), and if you pass it non-valid DocBook XML, it spits out
      all sort of cryptic errors.)

    - use xsltproc to convert to HTML:

          xsltproc --output foo.xhtml /usr/local/share/xsl/docbook/xhtml/docbook.xsl foo.xml

      (xsltproc is part of libxslt)

    - use xsltproc to convert to FO:

          xsltproc --stringparam  fop.extensions  1 --output foo.fo /usr/local/share/xsl/docbook/fo/docbook.xsl foo.xml

    - use fop to convert FO to DPF:

          fop foo.fo foo.pdf 

You can find libxml2, libxslt, fop, docbook-xml, and docbook-xsl in
ports.

Thomas

-- 
N.J. Thomas
njt at ayvali.org
Etiamsi occiderit me, in ipso sperabo


More information about the freebsd-questions mailing list