xslfo,xsl,pdf,html:在某些页面后为动态生成的pdf文档重置页脚页码

时间:2018-10-12 11:00:43

标签: html pdf xslt xsl-fo

<!--Page Footer-->
<fo:static-content flow-name="xsl-region-after">
<xsl:apply-templates select="footer" />
<fo:block text-align="right">

Page <fo:page-number/> of <fo:page-number-citation ref-id="document-end" />
Page <fo:page-number/> of <fo:page-number-citation ref-id="document-end-div" /> 

</fo:block>
</fo:static-content>

上面的代码位于htm文件中正在使用的xslt文件中。 htm文件用于生成可以具有动态页面数的pdf。

将pdf分为两部分,上面的代码中的“ document-end”表示代码中“ section”类型为“ section”和“ document-end-div”之一的末尾上方表示“ div”类型的另一部分。

When section 1 which is a div has 2 pages and section 2 which is a section has 4 pages then footer has the output as of now like:
For the 1st Page Footer: Page 1 of 2, Page 1 of 6
For the 2nd Page Footer: Page 2 of 2, Page 2 of 6
For the 3rd Page Footer: Page 3 of 2, Page 3 of 6
For the 4th Page Footer: Page 4 of 2, Page 4 of 6.....

Can you please help us to get the footer output as:
For the 1st Page Footer: Page 1 of 2
For the 2nd Page Footer: Page 2 of 2
For the 3rd Page Footer: Page 1 of 4
For the 4th Page Footer: Page 2 of 4
For the 4th Page Footer: Page 3 of 4
For the 4th Page Footer: Page 4 of 4.....

注意:Pdf页码是动态的,属于这两个部分的页数也是动态的。

1 个答案:

答案 0 :(得分:0)

您可以在页面序列的开始处重置fo:page-number,因此看起来您必须修改模板才能为每个部分开始新的页面序列。

顺便说一下,在重新启动页码的PDF中导航很困难。在目录中,例如:

  • 如果TOC条目显示为“ Installation ... page 226”(安装...第226页),则可以立即清楚地知道读者必须去哪里(特别是在打印PDF时)
  • 如果TOC条目显示为“ Installation ... page 14-1”(安装...第14-1页),则您必须翻页查找第14节,而无需指出该内容可能在何处。

您仍然可以在文档的页脚中放置一个区域指示符,例如页脚中的节号和标题(使用标记读取标题信息)。