Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XSL FO Docbook content left margin

I'm using Docbook 5 (docbook-xsl-ns), generating PDF with Apache FOP and I would like to move all text to the left. How can I do it?

Source XML is:

<section>
        <title>Usage</title>
        <programlisting>mvn archetype:generate -DarchetypeGroupId=cz.csob.javor -DarchetypeArtifactId=javor-archetypes-subcomponent -DarchetypeVersion=X.Y.Z</programlisting>
        <para>During the subcomponent project generation you will be asked for the following properties:</para>
        <itemizedlist>
            <listitem>
                <para><emphasis>parent-component-id</emphasis> - ID of the parent component, should be the name of the directory the parent component project is placed in</para>
            </listitem>
            <listitem>...

enter image description here

Thanks.

like image 308
Xdg Avatar asked Jun 21 '13 13:06

Xdg


1 Answers

Paragraph indentation added by body.start.indent parameter.

You should set value to this parameter with measurement, because it's used in other XSLT templates for calculations. For example, next line will remove paragraph indentation at all:

<xsl:param name="body.start.indent">0pt</xsl:param>

All XSLT customization layer should be something like:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    version="1.0">
    <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
    <xsl:param name="body.start.indent">0pt</xsl:param>
</xsl:stylesheet>

Reference documentation for this topic

Also can be used other indentation options:

  • page.margin.inner - left page margin
  • page.margin.outer - right page margin

Top and bottom margins (from documentation)

For example next params will make this page layout 3:

<xsl:param name="page.margin.inner">20mm</xsl:param>
<xsl:param name="page.margin.outer">10mm</xsl:param>
<xsl:param name="page.margin.top">12.5mm</xsl:param>
<xsl:param name="page.margin.bottom">15mm</xsl:param>

<xsl:param name="region.before.extent">10mm</xsl:param>
<xsl:param name="region.after.extent">5mm</xsl:param>

<xsl:param name="body.margin.top">15mm</xsl:param>
<xsl:param name="body.margin.bottom">15mm</xsl:param>

Resulting page layout

like image 191
Viacheslav Molokov Avatar answered Sep 29 '22 10:09

Viacheslav Molokov