跨页母版扩展 no-LT
Antenna House Formatter V7.5 能够将左右对开的两页(跨页)作为一个整体处理,您可以定义横跨这两页的跨页区域,也可以为这两页定义统一的背景。
将对开页作为跨页排版的需求,见于以下文档:
- Extensible Stylesheet Language (XSL) Requirements Version 2.0(W3C 工作草案,2008 年 3 月 26 日)
- Requirements for Latin Text Layout and Pagination(W3C 编辑草案,2015 年 8 月 17 日)
- List of CSS features required for paged media(2014 年 12 月 4 日)
只有部分文档需要跨页,跨页的用途包括:
- 横跨两页的标题
- 宽于一页的图形或表格
- 横跨两页的全出血背景图像
跨页母版扩展新增了以下两个格式化对象:
| FO | 定义 |
|---|---|
| <axf:spread-page-master> | 定义跨页。 |
| <axf:spread-region> | 可横跨两页的区域。 |
跨页通常是常规排版之外的特例,因此 <axf:spread-page-master> 会引用其他页面母版来定义这两页的尺寸和非跨页区域。当 <axf:spread-region> 与某个页面母版中的 <fo:region-body> 相交时,该 <fo:region-body> 会被缩小为一个较小的矩形区域;当 <axf:spread-region> 覆盖了某个页面母版中的 <fo:region-body> 时,该 <fo:region-body> 将从该跨页中移除。
| 注意: | 跨页母版扩展在 Antenna House Formatter V7.5 Lite 中无效。 |
|---|
扩展元素
<axf:spread-page-master> no-LT
- 常见用法:
指定跨页(两页对开)。
- 区域:
不直接生成区域。它用于由 <fo:page-sequence> 生成页面的过程中。
- 约束条件:
-
<!ELEMENT axf:spread-page-master (axf:spread-region*)> <!ATTLIST axf:spread-page-master master-name CDATA #REQUIRED> <!ATTLIST axf:spread-page-master axf:left-page-master-reference CDATA #REQUIRED> <!ATTLIST axf:spread-page-master axf:right-page-master-reference CDATA #REQUIRED>
<axf:spread-page-master> 在页面母版的选择上与 <fo:simple-page-master> 用法相同,但它始终会生成偶数(2 的倍数)个页面。您必须确保这些页面成对地构成跨页。有助于实现这一点的属性包括 maximum-repeats、initial-page-number 和 force-page-count。
如果 <axf:spread-region> 子元素生成了页面上的全部区域(例如跨页为跨多页的双页宽表格),但您无法预知跨页内容将占用多少对页面,那么 <axf:spread-page-master> 应当是 <fo:page-sequence-master> 中的最后一个页面母版,或者跨页的内容应放在仅使用 <axf:spread-page-master> 的 嵌套的 <fo:page-sequence> 中。
| 注意: | 由 axf:left-page-master-reference 和 axf:right-page-master-reference 所指示的左页和右页,必须具有相同的页面高度以及相同的上下边距。 |
|---|
<axf:spread-region> no-LT
- 常见用法:
指定跨页(两页对开)中的区域。
- 区域:
每当其父元素 <axf:spread-page-master> 用于生成页面时,用于生成一个 region-viewport-area 和一个 region-reference-area。
- 约束条件:
-
<!ELEMENT axf:spread-region EMPTY> <!ATTLIST axf:spread-region region-name CDATA #REQUIRED> <!ATTLIST axf:spread-region width CDATA "auto"> <!ATTLIST axf:spread-region height CDATA "auto"> <!ATTLIST axf:spread-region overflow CDATA "auto"> <!ATTLIST axf:spread-region reference-orientation CDATA "0"> <!ATTLIST axf:spread-region writing-mode CDATA "lr-tb"> <!ATTLIST axf:spread-region %common-absolute-position-properties;> <!ATTLIST axf:spread-region %common-border-padding-and-background-properties;> <!ATTLIST axf:spread-region %common-margin-properties-block;>
扩展属性
axf:left-page-master-reference no-LT
跨页中左页所用页面母版的母版名称。
| 值: | <name> |
| 初始值: | N/A,该值为必需 |
| 适用于: | axf:spread-page-master |
| 是否继承: | 否 |
| 百分比: | N/A |
各值的含义如下:
- <name>
该名称必须引用文档中已存在的 master-name。
axf:left-page-master-reference 引用的页面母版,用于定义跨页中左侧页面的页面尺寸和非跨页区域。
axf:right-page-master-reference no-LT
跨页中右页所用页面母版的母版名称。
| 值: | <name> |
| 初始值: | N/A,该值为必需 |
| 适用于: | axf:spread-page-master |
| 是否继承: | 否 |
| 百分比: | N/A |
各值的含义如下:
- <name>
该名称必须引用文档中已存在的 master-name。
axf:right-page-master-reference 引用的页面母版,用于定义跨页中右侧页面的页面尺寸和非跨页区域。
示例
以下示例展示了使用 <axf:spread-page-master> 生成的两个页面。页面尺寸和非跨页区域的定义来自“left”和“right”这两个 <fo:simple-page-master>,它们由名为“spreadpm”的 <axf:spread-page-master> 引用。该 <axf:spread-page-master> 定义了一个横跨该跨页两个页面的“top”<axf:spread-region>。在本例中,“top”区域包含一个标题。“xsl-region-body”流的内容,则在两个 <fo:page-sequence-master> 中由 <fo:region-body> 所定义的正文区域内生成区域。
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:axf="http://www.antennahouse.com/names/XSL/Extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="left" page-width="70mm" page-height="100mm">
<fo:region-body margin="36pt" background-color="#E1E8E2" padding="6pt"/>
<fo:region-before region-name="left-header" extent="36pt" padding-start="36pt" display-align="center"/>
<fo:region-after extent="36pt" padding-start="36pt" display-align="center"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="right" page-width="70mm" page-height="100mm">
<fo:region-body margin="36pt" background-color="#E1E8E2" padding="6pt"/>
<fo:region-before region-name="right-header" extent="36pt" padding-end="36pt" display-align="center"/>
<fo:region-after extent="36pt" padding-end="36pt" display-align="center"/>
</fo:simple-page-master>
<axf:spread-page-master master-name="spreadpm" left-page-master-reference="left" right-page-master-reference="right">
<axf:spread-region region-name="top" margin="36pt" margin-bottom="72mm"/>
</axf:spread-page-master>
<fo:page-sequence-master master-name="psm">
<fo:repeatable-page-master-reference master-reference="spreadpm"/>
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="left" odd-or-even="even"/>
<fo:conditional-page-master-reference master-reference="right" odd-or-even="odd"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="psm" initial-page-number="2" force-page-count="end-on-odd">
<fo:static-content flow-name="left-header">
<fo:block text-align="outside" margin="0">left</fo:block>
</fo:static-content>
<fo:static-content flow-name="right-header">
<fo:block text-align="outside" margin="0">right</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align="outside" margin="0"><fo:page-number /></fo:block>
</fo:static-content>
<fo:flow flow-name="top">
<fo:block-container height="100%" color="#003D19" font-size="100pt" overflow="condense" axf:overflow-condense="font-size" font-weight="bold">
<fo:block>axf:spread-page-master</fo:block>
</fo:block-container>
</fo:flow>
<fo:flow flow-name="xsl-region-body">
<fo:block>
<fo:inline font-weight="bold">Antenna House Formatter</fo:inline> is able to treat two facing pages (a two-page spread) as a single unit, and you can define spread regions that span across the two pages. You can also define a single background for the two pages.
</fo:block>
<fo:block text-indent="1em">
Only some documents need spreads, but uses for spreads include: titles that extend across two pages; graphics or tables that are wider than one page; full-bleed background images that extend across two pages.
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
