Skip to content

Commit 57397e7

Browse files
committed
Added support for pageCount in fj-doc-mod-fop
1 parent 6108e48 commit 57397e7

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

fj-doc-mod-fop/src/main/resources/fj_doc_mod_fop_config/template/fop_doc.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,6 @@
9090
<fo:block>
9191
<@doc_element.handleElementList elements=docBase.docBody.elementList/>
9292
</fo:block>
93-
</fo:flow>
93+
<fo:block id="EndOfDocument"></fo:block></fo:flow>
9494
</fo:page-sequence>
9595
</fo:root>

fj-doc-mod-fop/src/main/resources/fj_doc_mod_fop_config/template/macro/doc_element.ftl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
</#macro>
4747

4848
<#macro handleParaRole current role>
49-
<fo:block <#if (current.id)??> id="${current.id}" </#if> <@handleFormat formatValue=current.format!''/><@handleWhiteSpace element=current/><@handleRole role=role element=current/><@handleStyle styleValue=current.originalStyle/><@handleParaSpacing textIndent=current.textIndent!0 spaceBefore=current.spaceBefore!0 spaceAfter=current.spaceAfter!0 spaceLeft=current.spaceLeft!0 spaceRight=current.spaceRight!0/><@handleAlign alignValue=current.align/><@handleFont element=current/>><![CDATA[${current.text?replace(r"${currentPage}","]]><fo:page-number/><![CDATA[")}]]><#list current.elementList as currentChild><@handleElement current=currentChild/></#list></fo:block>
49+
<fo:block <#if (current.id)??> id="${current.id}" </#if> <@handleFormat formatValue=current.format!''/><@handleWhiteSpace element=current/><@handleRole role=role element=current/><@handleStyle styleValue=current.originalStyle/><@handleParaSpacing textIndent=current.textIndent!0 spaceBefore=current.spaceBefore!0 spaceAfter=current.spaceAfter!0 spaceLeft=current.spaceLeft!0 spaceRight=current.spaceRight!0/><@handleAlign alignValue=current.align/><@handleFont element=current/>><@handleTextSubstitution text=current.text /><#list current.elementList as currentChild><@handleElement current=currentChild/></#list></fo:block>
5050
</#macro>
5151

5252
<#macro handlePara current>
@@ -162,3 +162,5 @@
162162
<#macro handleAlign alignValue> <#if alignValue = 1>text-align="left"<#elseif alignValue = 2>text-align="center"<#elseif alignValue = 3>text-align="right"<#elseif alignValue = 8 || alignValue = 9>text-align="justify"</#if> </#macro>
163163

164164
<#macro handleStyle styleValue> <#if styleValue = 2>font-weight="bold"<#elseif styleValue = 3>text-decoration="underline"<#elseif styleValue = 4>font-style="italic"<#elseif styleValue = 5>font-style="italic" font-weight="bold"<#elseif styleValue = 1>font-style="normal" font-weight="normal"</#if> </#macro>
165+
166+
<#macro handleTextSubstitution text><![CDATA[${text?replace(r"${currentPage}","]]><fo:page-number/><![CDATA[")?replace(r"${pageCount}","]]><fo:page-number-citation ref-id='EndOfDocument'/><![CDATA[")}]]></#macro>

fj-doc-sample/src/test/resources/dev/test-xml-01.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<info name="doc-creator">fj-doc (Venus) Sample</info>
1313
<info name="doc-language">en</info>
1414
<footer-ext numbered="true">
15-
<para align="center">Page ${currentPage}</para>
15+
<para align="center">Page ${currentPage} of ${pageCount}</para>
1616
</footer-ext>
1717
<bookmark-tree>
1818
<bookmark ref="b1">Bookmark 1</bookmark>

0 commit comments

Comments
 (0)