Hi,

Looking at the source code, I could trace a possible cause for this bug.
In o.a.f..layoutmgr.PageProvider, in the method getPage
a test is done to verify if the page is the last one
 boolean isLastPage = (lastPageIndex >= 0) && (index == lastPageIndex);

In the case of the fo attached (onlypage.fo) this test returns false
as lastPageIndex is still initialized to -1.

Further down the processing,
in o.a.f.fo.pagination.ConditionalPageMasterReference isValid method
the test (pagePosition == EN_ONLY && (isFirstPage && isLastPage)) fails


I do not have enough experience with the fop source code to provide a
possible patch, but hopefully this could help someone to do it for me.

Thanks in advance

Franck




On Tue, Oct 30, 2012 at 11:34 AM, franck FIMBEL <ffim...@gmail.com> wrote:

> Thanks
>
> I filled the bug
>
> *Bug 54074 <https://issues.apache.org/bugzilla/show_bug.cgi?id=54074> ** 
> *page-position="only"
> in conditional-page-master-reference does not work
>
>
> On Tue, Oct 30, 2012 at 10:18 AM, Pascal Sancho <psancho....@gmail.com>wrote:
>
>> Hi,
>>
>> This should work.
>> Please, file in a new bug entry, attaching the material you gave here.
>>
>> 2012/10/29 franck FIMBEL <ffim...@gmail.com>:
>> > Hi,
>> >
>> > I am trying to use the attribute page-position="only" in a
>> > conditional-page-master-reference in order to produce a different page
>> > header if the document has only one page (if I understood correctly, it
>> > applies if the page is the first and the last page of the document at
>> the
>> > same time).
>> >
>> > <fo:page-sequence-master master-name="Section_1">
>> >       <fo:repeatable-page-master-alternatives>
>> >         <fo:conditional-page-master-reference master-reference="Single"
>> > page-position="only" />
>> >         <fo:conditional-page-master-reference
>> master-reference="Multiple"
>> > />
>> >       </fo:repeatable-page-master-alternatives>
>> >     </fo:page-sequence-master>
>> >
>> > Unfortunately, using the attached fo and fop trunk, it does not work as
>> > expected.
>> > I get the header for multiple page even if I only have one page in the
>> final
>> > output document.
>> >
>> > If I change the attribute to last, it works fine.
>> >  <fo:page-sequence-master master-name="Section_1">
>> >       <fo:repeatable-page-master-alternatives>
>> >         <fo:conditional-page-master-reference master-reference="Single"
>> > page-position="last" />
>> >         <fo:conditional-page-master-reference
>> master-reference="Multiple"
>> > />
>> >       </fo:repeatable-page-master-alternatives>
>> >     </fo:page-sequence-master>
>> >
>> >
>> >
>> > Is there something wrong with the way I use this attribute.
>> >
>> > Thanks in advance for your help
>>
>>
>> --
>> pascal
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
>>
>>
>
>
> --
> Franck
>



-- 
Franck

Reply via email to