最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】去除docbook中生成的pdf中的那两页的titlepage

Docbook crifan 2363浏览 0评论

【背景】

docbook生成的pdf,默认都有前两页的那个titlepage:

two page is titlepage

想要去掉。

【解决过程】

1.找了半天,貌似官网的这部分:

Custom page design

的介绍,是相关的内容。

2.找到对应的

docbook-xsl-ns-1.77.1\fo\pagesetup.xsl

然后找到了对应的titlepage部分的内容:

<!-- title pages -->
<fo:simple-page-master master-name="titlepage-first"

<fo:simple-page-master master-name="titlepage-odd"

<fo:simple-page-master master-name="titlepage-even"

所以,去把这部分代码注释掉,然后看看docbook能否正常编译。

结果会出错的:

org.apache.fop.apps.FOPException: No simple-page-master matching "titlepage-first" in page-sequence-master "titlepage". (See position 116:54)

org.apache.fop.fo.pagination.PageProductionException: No simple-page-master matching "titlepage-first" in page-sequence-master "titlepage". (See position 116:54)

        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:302)

        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)

        at org.apache.fop.cli.Main.startFOP(Main.java:174)

        at org.apache.fop.cli.Main.main(Main.java:205)

Caused by: org.apache.fop.fo.pagination.PageProductionException: No simple-page-master matching "titlepage-first" in page-sequence-master "titlepage". (See position 116:54)

        at org.apache.fop.fo.pagination.PageProductionException$PageProductionExceptionFactory.createException(PageProductionException.java:93)

        at org.apache.fop.events.EventExceptionManager.throwException(EventExceptionManager.java:54)

        at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBroadcaster.java:175)

        at $Proxy0.noMatchingPageMaster(Unknown Source)

        at org.apache.fop.fo.pagination.PageSequenceMaster.getNextSimplePageMaster(PageSequenceMaster.java:221)

        at org.apache.fop.fo.pagination.PageSequence.getNextSimplePageMaster(PageSequence.java:273)

        at org.apache.fop.layoutmgr.PageProvider.cacheNextPage(PageProvider.java:326)

        at org.apache.fop.layoutmgr.PageProvider.getPage(PageProvider.java:293)

        at org.apache.fop.layoutmgr.PageProvider.getPage(PageProvider.java:257)

        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.createPage(PageSequenceLayoutManager.java:139)

        at org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.makeNewPage(AbstractPageSequenceLayoutManager.java:289)

        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:103)

        at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)

        at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)

        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)

        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)

        at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)

        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

        at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)

        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)

        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)

        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)

        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299)

        … 3 more

———

org.apache.fop.fo.pagination.PageProductionException: No simple-page-master matching "titlepage-first" in page-sequence-master "titlepage". (See position 116:54)

        at org.apache.fop.fo.pagination.PageProductionException$PageProductionExceptionFactory.createException(PageProductionException.java:93)

        at org.apache.fop.events.EventExceptionManager.throwException(EventExceptionManager.java:54)

        at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBroadcaster.java:175)

        at $Proxy0.noMatchingPageMaster(Unknown Source)

        at org.apache.fop.fo.pagination.PageSequenceMaster.getNextSimplePageMaster(PageSequenceMaster.java:221)

        at org.apache.fop.fo.pagination.PageSequence.getNextSimplePageMaster(PageSequence.java:273)

        at org.apache.fop.layoutmgr.PageProvider.cacheNextPage(PageProvider.java:326)

        at org.apache.fop.layoutmgr.PageProvider.getPage(PageProvider.java:293)

        at org.apache.fop.layoutmgr.PageProvider.getPage(PageProvider.java:257)

        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.createPage(PageSequenceLayoutManager.java:139)

        at org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.makeNewPage(AbstractPageSequenceLayoutManager.java:289)

        at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:103)

        at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:238)

        at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:120)

        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:349)

        at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:177)

        at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)

        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)

        at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)

        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)

        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)

        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)

        at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:299)

        at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)

        at org.apache.fop.cli.Main.startFOP(Main.java:174)

        at org.apache.fop.cli.Main.main(Main.java:205)

../../../config/docbook.mk:386: recipe for target `../output/pdf/usb_hid.pdf’ failed

make: *** [../output/pdf/usb_hid.pdf] Error 1

所以,不能此处直接去掉,看来还要想其他办法。

3.后来,貌似可以通过,直接在你的docbook的xml源码中,不写book,而直接写chapter的内容,比如类似于这样的代码:

<?xml version='1.0' encoding="utf-8"?>

<!DOCTYPE chapter
[

<!ENTITY % crl_ent PUBLIC "crl.ent" 'https://www.crifan.com/files/res/docbook/entity/crl.ent'>
%crl_ent;

]>

<chapter
    xmlns="http://docbook.org/ns/docbook"
    xmlns:xi="http://www.w3.org/2001/XInclude"
    xmlns:xl="http://www.w3.org/1999/xlink"

    xml:id="ch01_reduced_instruction_set">
<title>在精简指令集以减小代码空间占用方面的对比</title>
<abstract></abstract>

<sect1><title>ARM中的Thumb模式</title>
...
</sect1>

<sect1><title>MIPS中的MIPS16e ASE</title>
...
</sect1>

</chapter>

然后去编译,生成对应的pdf中,就没了对应的titlepage了。

当然变成了,对应的各个章节了:

no titlepage but is chapter

 

【总结】

想要在docbook中,去除titlepage的部分,

则可以在写docbook的xml中,就只用对应的chapter,而不要用book,即可。

转载请注明:在路上 » 【已解决】去除docbook中生成的pdf中的那两页的titlepage

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.155 seconds, using 22.03MB memory