In this article I'll discuss two points about docbook that generate to PDF.I use the ant to generate docbook,following is my ant file.
<!--
- target: build-pdf
- description: Iterates through a directory and transforms
- .xml files into .fo files which can then be turned into DocBook XML
- files.
-->
<target name="build-pdf" depends="depends"
description="Generates PDF files from DocBook XML">
<xslt style="${fo.stylesheet}" extension=".fo"
basedir="${basedir}/src" destdir="${target.dir}/fo">
<classpath refid="xalan.classpath" />
<include name="**/*.xml" />
<exclude name="**/*chapter*.xml"/>
</xslt>
<property name="fop.home" value="${basedir}/lib/fop-0.95"/>
<taskdef name="fop" classname="org.apache.fop.tools.anttasks.Fop">
<classpath>
<fileset dir="${fop.home}/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${fop.home}/build">
<include name="fop.jar" />
</fileset>
</classpath>
</taskdef>
<fop format="application/pdf"
outdir="${target.dir}/pdf" basedir="${target.dir}/fo">
<fileset dir="${target.dir}/fo">
<include name="*.fo"/>
</fileset>
</fop>
</target>
following is my dobook segment:
<sect1>
<title>Section 1 title</title>
<para>
<sect2>
<title>section 2 title</title>
<para>
description...
</para>
<sect3>
<para>witing something...</para>
<sect3>
</sect2>
</sect1>
Now the question is;
1)I want to display the label of section.
2)I want to display the bookmark in PDF.
The final solution is change the param.xml file.
1)to display the label of section:
change following line
<xsl:param name="section.autolabel" select="0">
to this line
<xsl:param name="section.autolabel" select="1">
2)to display the bookmark in PDF.
change following line
<xsl:param name="fop1.extensions" select="0">
to this line
<xsl:param name="fop1.extensions" select="1">
Note:don't change following line otherwise you will get an exception like:
No element mapping definition found for (Namespace URI: "http://xml.apache.org/fop/extensions", Local Name: "destination")
<xsl:param name="fop.extensions" select="0">
Wednesday, September 17, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment