You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by franck FIMBEL <ff...@gmail.com> on 2012/10/29 16:07:50 UTC

page-position="only" in conditional-page-master-reference

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



-- 
Franck

Re: page-position="only" in conditional-page-master-reference

Posted by Alexios Giotis <al...@gmail.com>.
Hi Franck,

Since there is already a ticket for this, It would be better to add it as a comment. After the migration to Jira, the link is

https://issues.apache.org/jira/browse/FOP-2148

Alexis


On 19 Dec 2012, at 19:42, franck FIMBEL <ff...@gmail.com> wrote:

> 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 <ff...@gmail.com> wrote:
> Thanks
> 
> I filled the bug 
> 
> Bug 54074  page-position="only" in conditional-page-master-reference does not work
> 
> 
> On Tue, Oct 30, 2012 at 10:18 AM, Pascal Sancho <ps...@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 <ff...@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-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 
> 
> -- 
> Franck
> 
> 
> 
> -- 
> Franck


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: page-position="only" in conditional-page-master-reference

Posted by franck FIMBEL <ff...@gmail.com>.
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 <ff...@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 <ps...@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 <ff...@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-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>>
>
>
> --
> Franck
>



-- 
Franck

Re: page-position="only" in conditional-page-master-reference

Posted by franck FIMBEL <ff...@gmail.com>.
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 <ps...@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 <ff...@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-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>


-- 
Franck

Re: page-position="only" in conditional-page-master-reference

Posted by Pascal Sancho <ps...@gmail.com>.
Hi,

This should work.
Please, file in a new bug entry, attaching the material you gave here.

2012/10/29 franck FIMBEL <ff...@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-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org