Hi,

I'm new to FOP and feeling a little disoriented about the correct way to
change the look of the PDF that is output by FOP.

My source is an AsciiDoc text file and I have no trouble converting that to
a Docbook XML file.

    $ asciidoc --backend=docbook45 book.txt

I can then use the fop command line tool to convert to a PDF file.

    $ fop-2.1/fop -xml book.xml                             \
                  -xsl docbook-xsl-ns-1.79.1/fo/docbook.xsl \
                  -pdf book.pdf

The default look of the produced book.pdf is nice but I'd like to adjust
font families, font sizes, margins, etc.

I did discover one way to customize the fonts by creating a fop.xconf file
with the following content

    <fop version="1.0">
        <renderers>
            <renderer mime="application/pdf">
                <fonts>
                    <font kerning="yes"
embed-url="fonts/MyriadPro-Cond.otf" embedding-mode="subset">
                        <font-triplet name="Myriad-Condensed"
style="normal" weight="normal"/>
                    </font>
                    <font kerning="yes"
embed-url="fonts/MinionPro-Regular.otf" embedding-mode="subset">
                        <font-triplet name="Minion-Regular" style="normal"
weight="normal"/>
                    </font>
                    <font kerning="yes" embed-url="fonts/Andale Mono.ttf"
embedding-mode="subset">
                        <font-triplet name="Andale-Mono" style="normal"
weight="normal"/>
                    </font>
                </fonts>
            </renderer>
        </renderers>
    </fop>

and then using the following command

    $ fop-2.1/fop -c fop.xconf                                \
                  -xml book.xml                               \
                  -xsl docbook-xsl-ns-1.79.1/fo/docbook.xsl   \
                  -param body.font.family Minion-Regular      \
                  -param title.font.family Myriad-Condensed   \
                  -param monospace.font.family Andale-Mono    \
                  -pdf book.pdf

Even though the above font setting technique was something I learned from a
blog on the Web, at this point, I'm already unsure if I'm going in the
right to doing this kind of customization properly or not. I imagine there
is a better way to than passing a growing number of parameters to the fop
command line tool.

Then I tried to see if I could have an affect on margins and the footer
font.

    $ fop-2.1/fop -c fop.xconf                                \
                  -xml book.xml                               \
                  -xsl docbook-xsl-ns-1.79.1/fo/docbook.xsl   \
                  -param body.font.family Minion-Regular      \
                  -param title.font.family Myriad-Condensed   \
                  -param page.margin.top 0                    \
                  -param footer.content.font-family Helvetica \
                  -param monospace.font.family Andale-Mono    \
                  -pdf book.pdf

The page.margin.top param did work. A small success!

The footer.content.font-family param did not work. I also tried
footer.content.properties.font-family, footer.content.font.family, and
footer.content.properties.font.family without finding the right solution.

What's the right way to configure things so fop is outputting the PDF I
dream of sharing with folks?

Thanks!

Peter

Reply via email to