通过 fop 将 docbook 处理为 PDF 时出现不需要的第二个标题页

发布于 2025-01-08 11:28:04 字数 2338 浏览 2 评论 0原文

我正在dockbook xml 中构建标准书籍格式,然后通过fop 将其格式化为PDF。

然而,当我构建最终的 PDF 时,我得到了第二个损坏的标题页,其中再次包含标题和内嵌图像。在此页面上,标题在整个页面上对齐(因此分布得很奇怪),并且图像偏离中心。

标题后面还有一个额外的冒号,但书名中没有该冒号。

如果我使用 XSL 参数删除标题页,则标题页将被删除,但损坏的标题页仍保留在 PDF 中。

我可以看到在 .fo 文件中生成第二页的额外行,但无法弄清楚它是如何通过 xsltproc 到达那里的。 我的第一个假设是它会自动创建标题页,然后在浏览其他章节之前再次重新解释标题。

如果我通过 oXygen 导出,我不会遇到这个标题页问题,这使得它更加令人困惑。

这是书籍代码:

<!DOCTYPE book [
<!ENTITY chap1 SYSTEM "01_n.xml">
<!ENTITY chap2 SYSTEM "02_n.xml">
<!ENTITY chap3 SYSTEM "03_n.xml">
<!ENTITY chap4 SYSTEM "04_n.xml">
<!ENTITY chap5 SYSTEM "05_n.xml">
<!ENTITY chap6 SYSTEM "06_n.xml">
<!ENTITY chap7 SYSTEM "07_n.xml">
<!ENTITY chap8 SYSTEM "08_n.xml">
<!ENTITY chap9 SYSTEM "09_n.xml">
<!ENTITY chap10 SYSTEM "10_n.xml">
<!ENTITY chap11 SYSTEM "11_n.xml">
<!ENTITY chap12 SYSTEM "12_n.xml">
<!ENTITY chap13 SYSTEM "13_n.xml">
<!ENTITY chap14 SYSTEM "14_n.xml">
<!ENTITY chap15 SYSTEM "15_n.xml">
<!ENTITY chap16 SYSTEM "16_n.xml">
<!ENTITY chap17 SYSTEM "17_n.xml">
<!ENTITY chap18 SYSTEM "18_n.xml">
]>

<book xmlns="http://docbook.org/ns/docbook" version="5.0">
    <info>
        <title>Manual</title>
         <subtitle>
            <inlinemediaobject>
                <imageobject>
                    <imagedata fileref="logo.png" format="image_format" scalefit="1" width="100%" contentdepth="100%" />
                </imageobject>
            </inlinemediaobject>
        </subtitle>
    </info>

    &chap1;
    &chap2;
    &chap3;
    &chap4;
    &chap5;
    &chap6;
    &chap7;
    &chap8;
    &chap9;
    &chap10;
    &chap11;
    &chap12;
    &chap13;
    &chap14;
    &chap15;
    &chap16;
    &chap17;
    &chap18;
</book>

以及 makefile 的 pdf 部分:

pdf:   
    xsltproc  \
    --output  myfile.fo  \
    --stringparam  paper.type  A4  \
    /docbook/format.xsl \
    book.xml

    fop  -fo  myfile.fo  -pdf  myfile.pdf

    open myfile.pdf

我正在使用的formal.xsl 没有什么特别之处,如果我使用标准的docbook xsl 文件,我会得到相同的结果。

感谢您的帮助!通过搜索现有问题,我已经获得了很多有关文档格式设置的有用技巧。

I'm constructing a standard book format in dockbook xml then formatting it to PDF via fop.

When I construct the final PDF however i'm getting a second broken title page that has the title and the inline image again. On this page the title is justified across the whole page (so spread oddly) and the image is off-centre.

The title also has an additional colon after it that is not present in the book title.

If I remove the title page using XSL parameters, the title page is removed, but the broken title page still remains in the PDF.

I can see the extra line that is generating the second page in the .fo file, but can't work out how it's getting there via xsltproc.
My first assumption is that it is automatically creating the title page then reinterpreting the title again before it goes through the other chapters.

I don't get this title page problem if I export via oXygen, which makes it more baffling.

Here's the book code:

<!DOCTYPE book [
<!ENTITY chap1 SYSTEM "01_n.xml">
<!ENTITY chap2 SYSTEM "02_n.xml">
<!ENTITY chap3 SYSTEM "03_n.xml">
<!ENTITY chap4 SYSTEM "04_n.xml">
<!ENTITY chap5 SYSTEM "05_n.xml">
<!ENTITY chap6 SYSTEM "06_n.xml">
<!ENTITY chap7 SYSTEM "07_n.xml">
<!ENTITY chap8 SYSTEM "08_n.xml">
<!ENTITY chap9 SYSTEM "09_n.xml">
<!ENTITY chap10 SYSTEM "10_n.xml">
<!ENTITY chap11 SYSTEM "11_n.xml">
<!ENTITY chap12 SYSTEM "12_n.xml">
<!ENTITY chap13 SYSTEM "13_n.xml">
<!ENTITY chap14 SYSTEM "14_n.xml">
<!ENTITY chap15 SYSTEM "15_n.xml">
<!ENTITY chap16 SYSTEM "16_n.xml">
<!ENTITY chap17 SYSTEM "17_n.xml">
<!ENTITY chap18 SYSTEM "18_n.xml">
]>

<book xmlns="http://docbook.org/ns/docbook" version="5.0">
    <info>
        <title>Manual</title>
         <subtitle>
            <inlinemediaobject>
                <imageobject>
                    <imagedata fileref="logo.png" format="image_format" scalefit="1" width="100%" contentdepth="100%" />
                </imageobject>
            </inlinemediaobject>
        </subtitle>
    </info>

    &chap1;
    &chap2;
    &chap3;
    &chap4;
    &chap5;
    &chap6;
    &chap7;
    &chap8;
    &chap9;
    &chap10;
    &chap11;
    &chap12;
    &chap13;
    &chap14;
    &chap15;
    &chap16;
    &chap17;
    &chap18;
</book>

And the pdf part of the makefile:

pdf:   
    xsltproc  \
    --output  myfile.fo  \
    --stringparam  paper.type  A4  \
    /docbook/format.xsl \
    book.xml

    fop  -fo  myfile.fo  -pdf  myfile.pdf

    open myfile.pdf

There is nothing particularly special about the formal.xsl I am using, and I get the same result if I use the standard docbook xsl file.

Thanks for any help! I've already gained a lot useful tips for docbook formatting by searching though existing questions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ぶ宁プ宁ぶ 2025-01-15 11:28:04

mzjn 提供了线索:

我正在使用:

当我应该使用时:

后一个代码删除了第二个不可靠的页面,而前者仅删除了分页符。

mzjn provided the clue:

I was using:
<xsl:template name="book.titlepage.before.verso"/>

When I should have used:
<xsl:template name="book.titlepage.verso"/>

The latter code removes the second wonky page, whereas the former only removes the page break.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文