biz-Streamマニュアル XMLページレイアウトタグ リファレンス 第8章 グループ化 8.4 ページ番号による表示制御<page-selector>

8.4 ページ番号による表示制御<page-selector>


8.4.1機能説明

page-selector タグに含まれる項目をグループ化し、表示/非表示を制御します。
page-selector には先頭ページ・中間ページ・最終ページの3種類のページ属性があり、オブジェクトを奇数ページのみ表示する、偶数ページのみ表示するなどの指定ができます。

1グループ化できる項目

page-selector タグに追加できる子要素は以下の通りです。

種別 タグ名
横書きテキスト Label、LinkLabel、multi-text、 datetime-text
縦書きテキスト VerticalLabel、LinkVerticalLabel、multi-vtext
図形 Square
Line
バーコード 11.1 バーコードについて』の全て
2ページ属性

先頭ページ、中間ページ、最終ページの3つの属性に対して以下のように指定します。

ページ属性        指定方法
先頭ページ
(first-page 属性)
表示する (view) / 表示しない (none)
中間ページ
(between-page 属性)
全ての中間ページに表示する (all) / 全ての中間ページに表示しない (none) /奇数ページのみ表示する (odd) / 偶数ページのみ表示する (even)
最終ページ
(last-page 属性)
表示する (view) / 表示しない (none) / 奇数ページのみ表示する (odd) / 偶数ページのみ表示する (even)
  • Excel 出力、CSV 出力には非対応です。
  • page-selector タグを含むレイアウトを、bs:importした場合は、page-selectorタグ以外の部分をインポートします。


8.4.2属性説明

属性名 指定 説明 指定内容 初期値
name 任意 名前 CDATA なし
x 任意 X座標(相対座標) CDATA 0
y 任意 Y座標(相対座標) CDATA 0
width 任意 領域の幅 CDATA 0
height 任意 領域の高さ CDATA 0
unit 任意 単位 (Choice) mm / cm / in / px / pt mm
start-number ※1 任意 開始ページ番号 CDATA 1
rotate ※2 任意 回転対象になる子要素の回転角度 CDATA 0 ~ 360 0
local-page 任意 ローカルページカウンタ値の使用 (Choice) false:文書全体のページ / true:ローカルページカウンタによるページ FALSE
first-page 任意 先頭ページの表示指定 (Choice) -/view/none -(未指定)
between-page 任意 中間ページの表示指定 (Choice) -/all/none/odd/even -(未指定)
last-page 任意 最終ページの表示指定 (Choice) -/view/none/odd/even -(未指定)
  • (注) 初期値:出荷時のXMLデフォルト情報(default_values.properties)値を表します。ユーザにより値の変更が行われた場合は内容が異なります。
  • ※1ドキュメントレイアウトでfo:page-sequenceの属性bs:local-page-controlがtrueになっている場合start-numberを1以外に設定すると表示がおかしくなる場合があります。また、${page-number-total}を使用しての数値置き換えを行う場合も同様です。
  • ※2rotateの対象となる子要素は、Label、multi-text、daytime-text、LinkLabelです。


8.4.3記述例

page-selectorサンプル1

先頭ページ (first-page 属性) 、中間ページ (between-page 属性) 、最終ページ (last-page 属性) の3つの属性に対して表示制御を行います。
下表の①~⑤のパターンでは、各属性値を以下のように指定します。

表示パターン first-page 属性 between-page 属性 last-page 属性
① 1ページ目のみにテキストを表示する view none none
② 最終ページ以外にテキストを表示する view all none
③ 偶数ページのみにテキストを表示する none even even
④ 奇数ページのみにテキストを表示する view odd odd
⑤ 全てのページにテキストを表示する view all view

page-selectorサンプル1(『<biz-Stream_home>/sample/page-selector/page-selectorSample1-page.xml』)


<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Width="210mm" Height="297mm" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <flow-area name="flow-area" x="155" y="289" width="50" height="10" master-reference="detail_DS1" no-data-disabled="false">
        <flow-table line-height="10" record-type="details" view="layout">
            <flow-table-cell cell-width="50" align="horizon" text-align="left" cell-align="bottom" narrow="size">
                <Label Name="テキスト1" Width="50" Height="10" X="0" Y="0" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontColor="0,0,0" FontSize="12" FontStyle="PLAIN" Narrow="horizon">flow-areaのデータ流し込み</Label>
            </flow-table-cell>
        </flow-table>
    </flow-area>

    <!-- ① 1ページ目のみにテキストを表示する -->
    <Label Width="150" Height="11.411" X="24.059" Y="246.964" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="13" FontStyle="PLAIN" Narrow="horizon">① first-page="view"、between-page="none"、last-page="none"</Label>
    <page-selector x="24.053" y="224.445" width="150" height="20" local-page="false" first-page="view" between-page="none" last-page="none">
        <Square Width="150" Height="20" X="0" Y="0" LineColor="0,0,0" LineWidth="0.2" FillColor="204,255,255" LineStyle="Solid"/>
        <Label Width="93.669" Height="11.411" X="9.178" Y="4.175" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">① 1ページ目のみにテキストを表示する</Label>
    </page-selector>

    <!-- ② 最終ページ以外にテキストを表示する -->
    <Label Width="150" Height="11.411" X="23.706" Y="199.339" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="13" FontStyle="PLAIN" Narrow="horizon">② first-page="view"、between-page="all"、last-page="none"</Label>
    <page-selector x="24.053" y="177.525" width="150" height="" local-page="false" first-page="view" between-page="all" last-page="none">
        <Square Width="150" Height="20" X="0" Y="0" LineColor="0,0,0" LineWidth="0.2" FillColor="255,255,204" LineStyle="Solid"/>
        <Label Width="93.669" Height="11.411" X="8.825" Y="4.175" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">② 最終ページ以外にテキストを表示する</Label>
    </page-selector>

    <!-- ③ 偶数ページのみにテキストを表示する -->
    <Label Width="150" Height="11.411" X="23.706" Y="153.889" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="13" FontStyle="PLAIN" Narrow="horizon">③ first-page="none"、between-page="even"、last-page="even"</Label>
    <page-selector x="24.053" y="132.078" width="150" height="" local-page="false" first-page="none" between-page="even" last-page="even">
        <Square Width="150" Height="20" X="0" Y="0" LineColor="0,0,0" LineWidth="0.2" FillColor="255,204,204" LineStyle="Solid"/>
        <Label Width="93.669" Height="11.411" X="8.825" Y="4.175" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">③ 偶数ページのみにテキストを表示する</Label>
    </page-selector>

    <!-- ④ 奇数ページのみにテキストを表示する -->
    <Label Width="150" Height="11.411" X="24.823" Y="109.439" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="13" FontStyle="PLAIN" Narrow="horizon">④ first-page="view"、between-page="odd"、last-page="odd"</Label>
    <page-selector x="24.817" y="86.567" width="150" height="" local-page="false" first-page="view" between-page="odd" last-page="odd">
        <Square Width="150" Height="20" X="0" Y="0" LineColor="0,0,0" LineWidth="0.2" FillColor="204,255,204" LineStyle="Solid"/>
        <Label Width="93.669" Height="11.411" X="8.825" Y="4.175" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">④ 奇数ページのみにテキストを表示する</Label>
    </page-selector>

    <!-- ⑤ 全てのページにテキストを表示する -->
    <Label Width="150" Height="11.411" X="25.587" Y="63.675" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="13" FontStyle="PLAIN" Narrow="horizon">⑤ first-page="view"、between-page="all"、last-page="view"</Label>
    <page-selector x="25.581" y="40.803" width="150" height="" local-page="false" first-page="view" between-page="all" last-page="view">
        <Square Width="150" Height="20" X="0" Y="0" LineColor="0,0,0" LineWidth="0.2" FillColor="204,204,255" LineStyle="Solid"/>
        <Label Width="93.669" Height="11.411" X="8.825" Y="4.175" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">⑤ 全てのページにテキストを表示する</Label>
    </page-selector>
</Layout>



生成されるPDF(『<biz-Stream_home>/sample/page-selector/page-selectorSample1-1.pdf』)


page-selectorサンプル1

生成したPDFファイルが1ページのみの場合

上記のレイアウトファイルで、1ページのみのPDFファイルを生成した場合は、between-page 属性は無視され、first-page 属性と last-page 属性の組み合せで表示制御を行います。
どちらかの属性値に「none」が指定されている場合は「none」を優先します。(○:表示する、×:表示しない)

first-page 属性値と last-page 属性値の組み合わせパターン
first-page 属性 view view view view none none none none
last-page 属性 view none odd even view none odd even
1ページのみの場合の表示 × × × × × ×

生成されるPDF(『<biz-Stream_home>/sample/page-selector/page-selectorSample1-2.pdf』)


page-selectorサンプル1

page-selectorサンプル2

回転属性(rotate)を指定したサンプルです。

page-selectorサンプル2(『<biz-Stream_home>/sample/page-selector/page-selectorSample2-page.xml』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Width="297mm" Height="210mm" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
   <multi-text x="16.228" y="174.369" cell-width="139.7" cell-height="21.872" text-align="left" line-align="top" narrow="size" font-family="MSGothic" font-size="12" font-style="PLAIN" border-style="Solid" section-indent="0" text-indent="0" japanese-hyphenation="true" english-hyphenation="false" english-hyphenation-overrange="compress" flow="false"><page-selector>タグ内に配置したオブジェクトは、
   横書きテキスト、横書き複数行テキストのみ回転します。
   縦書きテキスト、図形、バーコードは回転しません。</multi-text>

<!-- ① rotate=0  -->
   <page-selector x="15" y="41" width="120" height="120" rotate="0" local-page="false" first-page="view">
       <Label Width="55" Height="10" X="5" Y="80" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">横書きテキスト</Label>
       <Label Width="60" Height="11" X="5" Y="105" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontColor="255,0,0" FontSize="20" FontStyle="PLAIN" Narrow="horizon">Rotate=0</Label>
       <multi-text x="5" y="40" cell-width="47" cell-height="28" text-align="left" line-align="top" narrow="size" line-space="2" font-family="MSGothic" font-size="12" font-style="PLAIN" font-color="0,0,255" border-color="0,0,0" border-width="0.2" border-style="Solid" section-indent="0" text-indent="0" japanese-hyphenation="true" english-hyphenation="false" english-hyphenation-overrange="compress" flow="false">横書き複数行テキスト
       横書き複数行テキスト
       横書き複数行テキスト</multi-text>
       <VerticalLabel Width="15" Height="45" X="90" Y="70" Horizon="right" Vertical="top" Font="VMSGothic" FontSize="12" FontStyle="PLAIN" Narrow="vertical">縦書きテキスト</VerticalLabel>
       <multi-vtext x="72" y="10" cell-width="40" cell-height="58" text-align="top" line-align="right" narrow="size" line-space="2" font-family="VMSGothic" font-size="12" font-style="PLAIN" font-color="0,0,255" border-color="0,0,0" border-width="0.2" border-style="Solid" section-indent="0" japanese-hyphenation="true" english-hyphenation="false" english-hyphenation-overrange="compress">縦書き複数行テキスト
       縦書き複数行テキスト
       縦書き複数行テキスト</multi-vtext>
       <Square Width="120" Height="120" X="0" Y="0" LineColor="0,0,0" LineWidth="0.2" LineStyle="Solid"/>
       <barcode-jan13 width="25" height="15" x="10" y="15">123456789</barcode-jan13>
   </page-selector>
   
<!-- ① rotate=30  -->
   <page-selector x="145" y="41" width="120" height="120" rotate="30" local-page="false" first-page="view">
       <Label Width="55" Height="10" X="5" Y="80" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">横書きテキスト</Label>
       <Label Width="60" Height="11" X="5" Y="105" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontColor="255,0,0" FontSize="20" FontStyle="PLAIN" Narrow="horizon">Rotate=30</Label>
       <multi-text x="5" y="40" cell-width="47" cell-height="28" text-align="left" line-align="top" narrow="size" line-space="2" font-family="MSGothic" font-size="12" font-style="PLAIN" font-color="0,0,255" border-color="0,0,0" border-width="0.2" border-style="Solid" section-indent="0" text-indent="0" japanese-hyphenation="true" english-hyphenation="false" english-hyphenation-overrange="compress" flow="false">横書き複数行テキスト
       横書き複数行テキスト
       横書き複数行テキスト</multi-text>
       <VerticalLabel Width="15" Height="45" X="90" Y="70" Horizon="right" Vertical="top" Font="VMSGothic" FontSize="12" FontStyle="PLAIN" Narrow="vertical">縦書きテキスト</VerticalLabel>
       <multi-vtext x="72" y="10" cell-width="40" cell-height="58" text-align="top" line-align="right" narrow="size" line-space="2" font-family="VMSGothic" font-size="12" font-style="PLAIN" font-color="0,0,255" border-color="0,0,0" border-width="0.2" border-style="Solid" section-indent="0" japanese-hyphenation="true" english-hyphenation="false" english-hyphenation-overrange="compress">縦書き複数行テキスト
       縦書き複数行テキスト 
       縦書き複数行テキスト</multi-vtext>
       <Square Width="120" Height="120" X="0" Y="0" LineColor="0,0,0" LineWidth="0.2" LineStyle="Solid"/>
       <barcode-jan13 width="25" height="15" x="10" y="15">123456789</barcode-jan13>
   </page-selector>
</Layout>


生成されるPDF(『<biz-Stream_home>/sample/page-selector/page-selectorSample2.pdf』)


page-selectorサンプル1

rotate属性=30の場合、オブジェクトの左下を起点として反時計回りに30度回転します。 <multi-text>の複数行テキストは、1行ずつそれぞれ回転します。
縦書きテキストは回転しません。

page-selectorサンプル3

特殊文字を指定し、ページ番号を表示させるサンプルです。

page-selectorサンプル3(『<biz-Stream_home>/sample/page-selector/page-selectorSample3-page.xml』)

<?xml version="1.0" encoding="UTF-8"?>
<!-- XML file created by biz-Stream Designer -->
<!-- biz-Stream Copyright BrainSellers.com Corp. -->
<Layout Width="150mm" Height="100mm" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:bs="http://www.brainsellers.com/schema" xmlns:svg="http://www.brainsellers.com/schema" xmlns:form="http://www.brainsellers.com/schema" xmlns:pdf="http://www.brainsellers.com/schema" version="5.0.0">
    <flow-area name="flow-area" x="110" y="100" width="50" height="10" master-reference="data-source" no-data-disabled="false">
        <flow-table line-height="10" record-type="details" view="layout">
            <flow-table-cell cell-width="50" align="horizon" text-align="left" cell-align="bottom" narrow="size">
                <Label Name="テキスト1" Width="50" Height="10" X="0" Y="0" Horizon="center" Vertical="bottom" Vector="horizon" Font="MSGothic" FontColor="204,204,204" FontSize="10" FontStyle="PLAIN" Narrow="horizon">flow-areaのデータ流し込み</Label>
            </flow-table-cell>
        </flow-table>
    </flow-area>
    <page-selector x="5" y="39" width="135" height="20" local-page="false" first-page="view" between-page="all" last-page="view">
        <Square Width="135" Height="20" X="0" Y="0" LineColor="0,0,0" LineWidth="0.2" LineStyle="Solid"/>
        <Label Width="37" Height="8" X="5" Y="5" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">現在のページ番号:</Label>
        <Label Width="20" Height="8" X="42" Y="5" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">${page-number-local}</Label>
        <Label Width="35" Height="8" X="70" Y="5" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">総ページ番号:</Label>
        <Label Width="20" Height="8" X="100" Y="5" Horizon="left" Vertical="center" Vector="horizon" Font="MSGothic" FontSize="12" FontStyle="PLAIN" Narrow="horizon">${page-number-total}</Label>
    </page-selector>
    <page-number x="60" y="10" width="5" height="8" text-align="center" line-align="center" font-size="12" page-number="page"/>
    <page-number x="69" y="10" width="5" height="8" text-align="center" line-align="center" font-size="12" page-number="total" local-page="false"/>
    <Line X="66" Y="11" StartX="2.5" StartY="6" EndX="0" EndY="0" LineWidth="0.2"/>
</Layout>

生成されるPDF(『<biz-Stream_home>/sample/page-selector/page-selectorSample2.pdf』)


page-selectorサンプル3