You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "ffimbel (JIRA)" <ji...@apache.org> on 2012/12/20 09:39:12 UTC

[jira] [Commented] (FOP-2148) page-position="only" in conditional-page-master-reference does not work

    [ https://issues.apache.org/jira/browse/FOP-2148?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13536865#comment-13536865 ] 

ffimbel commented on FOP-2148:
------------------------------

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.
                
> page-position="only" in conditional-page-master-reference does not work
> -----------------------------------------------------------------------
>
>                 Key: FOP-2148
>                 URL: https://issues.apache.org/jira/browse/FOP-2148
>             Project: Fop
>          Issue Type: Bug
>          Components: page-master/layout
>    Affects Versions: trunk
>         Environment: Operating System: 
> Platform: PC
>            Reporter: ffimbel
>         Attachments: lastpage.fo, lastpage.fo.pdf, onlypage.fo, onlypage.fo.pdf
>
>
> Using 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 does not work.
> I get the header for multiple page even if I only have one page in the final output document.
> <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>
> 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>
> I attached fo and pdf to reproduce the issue.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira