문제

I am generating documents that are set up like standard print books, with each chapter beginning on a recto (right-hand and odd-numbered) page. The first page has its own page master. Recently I've been given a requirement to also treat the last page specially. I can achieve the right-hand starts either by forcing the page count of the preceding page-sequence (what I had been doing), or by using break-before on the chapter itself. Unfortunately, either technique sometimes adds a blank page to the sequence which becomes the actual last or first page of that sequence (meaning that my last or first page with content does not get its correct page-master). I don't think there's a way to set up the conditional-page-master-references to allow for this, as I don't know when a chapter will need a blank page and when it will not.

My thought was that I could not add pages to the chapter's page-sequences, but instead create page-sequences between each chapter that would have a single blank conditional-page-master defined for the left-hand page. Unfortunately, it seems like when no condition is met the formatter (Antenna House 6.0) outputs a blank page anyway.

So, my question is, does anyone know of a way to conditionally generate a page, allowing that in some situations, no page will be generated? I have no idea what, if any, code would be useful to post here, but I'd be happy to post anything that would help me get to an answer.

One piece of code that might be useful: my blank page page-sequence-master.

<fo:page-sequence-master master-name="blank-verso">
    <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference master-reference="blankpage" odd-or-even="even" maximum-repeats="1"/>
    </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
도움이 되었습니까?

해결책

I think I solved this using maximum-repeats. The method I am using is as follows:

  <fo:page-sequence-master master-name="main">
     <fo:repeatable-page-master-alternatives maximum-repeats="2">
        <fo:conditional-page-master-reference master-reference="blankpage"
                                              blank-or-not-blank="blank"
                                              page-position="first"/>
        <fo:conditional-page-master-reference master-reference="first-main-recto"
                                              odd-or-even="odd"
                                              page-position="any"/>
        <fo:conditional-page-master-reference master-reference="body-main-verso"
                                              odd-or-even="even"
                                              page-position="rest"/>
        <fo:conditional-page-master-reference master-reference="last-main-verso"
                                              odd-or-even="even"
                                              page-position="last"/>
     </fo:repeatable-page-master-alternatives>
     <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference master-reference="blankpage" blank-or-not-blank="blank"/>
        <fo:conditional-page-master-reference master-reference="last-main-verso"
                                              odd-or-even="even"
                                              page-position="last"/>
        <fo:conditional-page-master-reference master-reference="last-main-recto"
                                              odd-or-even="odd"
                                              page-position="last"/>
        <fo:conditional-page-master-reference master-reference="first-main-recto"
                                              odd-or-even="even"
                                              page-position="first"/>
        <fo:conditional-page-master-reference master-reference="first-main-recto"
                                              odd-or-even="odd"
                                              page-position="first"/>
        <fo:conditional-page-master-reference master-reference="body-main-verso" odd-or-even="even"/>
        <fo:conditional-page-master-reference master-reference="body-main-recto" odd-or-even="odd"/>
     </fo:repeatable-page-master-alternatives>
  </fo:page-sequence-master>

where the last-main and first-main page-masters are defined as needed in my simple-page-masters section and my chapters are defined in such a way that they begin with a blank page if necessary (rather than ending on one) and force-page-count is set to no-force throughout.

I may actually have more conditionals than I need, but I'm erring on the safe side. The idea is that the first repeatable-page-master-alternatives will be used at most twice. If my chapter starts on a blank page, the 'blank' page-master will be used on the first (blank) page, and then my 'first' page-master will be used on the second page (which is the first page with content). If my chapter doesn't start on a blank page, the 'first' page-master will be used, followed by the 'body' page-master. 'last' page masters are defined as well, in the odd case of a 2-page chapter. After the second page, the second repeatable-page-master-alternatives kicks in, applying the expected masters throughout the rest of the chapter. Seems to be working and thought it might be useful to someone else, as 'maximum-repeats' doesn't seem to be a topic of a ton of discussion.

다른 팁

You can set page conditions in your conditional-page-master-reference. For example:

<fo:page-sequence-master master-name="recto-verso-document">
    <fo:repeatable-page-master-alternatives>
        <fo:conditional-page-master-reference odd-or-even="even" master-reference="page-even" blank-or-not-blank="not-blank"/>
        <fo:conditional-page-master-reference blank-or-not-blank="not-blank" odd-or-even="odd" page-position="first" master-reference="first-page-odd"/>
        <fo:conditional-page-master-reference blank-or-not-blank="not-blank" odd-or-even="odd" page-position="last" master-reference="last-page-odd"/>
        <fo:conditional-page-master-reference odd-or-even="odd" master-reference="page-odd" blank-or-not-blank="not-blank"/>
        <fo:conditional-page-master-reference blank-or-not-blank="blank" master-reference="alternate-blank"/>
    </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>

Setting the page-position="last" might be what you need.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top