2017-11-22 2 views
4

FOP를 사용하여 PDF를 생성하려고합니다.고정 된 두 번째 페이지를 생성 할 수 없습니다 - 틈

내 요구 사항 -

페이지 1 - 헤더 및 콘텐츠

2 페이지 - 용어

페이지 3 정적 페이지 - 1

그러나 페이지에서 오버 플로우, 오버 플로우가 없다 페이지 1에서 페이지 2가 생성되지 않습니다. 나는 아래

2 페이지에 대해 다른 레이아웃을 가지고, 두 번째 페이지는 페이지 1에서 오버 플로우가없는 경우에도 생성 할 그리고 레이아웃 세트 -

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" 
     xmlns:th="http://www.thymeleaf.org"> 
    <fo:layout-master-set> 
     <!-- layout for the first page --> 
     <fo:simple-page-master master-name="first" 
           th:attr="page-width=${dimensions.width} + 'in',page-height=${dimensions.height} + 'in',margin-right=${rightMargin} + 'in',margin-left=${leftMargin} + 'in'" 
           margin-top="0pt" margin-bottom="1in"> 
      <fo:region-body region-name="xsl-region-body" margin-top="3.3in" margin-bottom="0.375in"/> 
      <fo:region-before region-name="stmt-header" margin-top="0.5in"/> 
      <fo:region-after region-name="stmt-footer"/> 
     </fo:simple-page-master> 

     <!-- layout for the other pages --> 
     <fo:simple-page-master master-name="rest" 
           th:attr="page-width=${dimensions.width} + 'in',page-height=${dimensions.height} + 'in',margin-right=${rightMargin} + 'in',margin-left=${leftMargin} + 'in'" 
           margin-top="0pt" margin-bottom="1in"> 
      <fo:region-body margin-bottom="0.375in" margin-top="1in"/> 
      <fo:region-before region-name="stmt-header-1" margin-top="0.5in"/> 
      <fo:region-after region-name="stmt-footer"/> 
     </fo:simple-page-master> 

     <!-- layout for the other pages --> 
     <fo:simple-page-master master-name="terms" 
           th:attr="page-width=${dimensions.width} + 'in',page-height=${dimensions.height} + 'in',margin-right=${rightMargin} + 'in',margin-left=${leftMargin} + 'in'" 
           margin-top="0pt" margin-bottom="1in"> 
      <fo:region-body margin-top="10in" margin-bottom="0.1in"/> 
      <fo:region-before region-name="stmt-terms" margin-top="0.5in"/> 
      <fo:region-after region-name="stmt-footer-1"/> 
     </fo:simple-page-master> 

     <fo:page-sequence-master master-name="Statement"> 
      <!--<fo:repeatable-page-master-alternatives>--> 
       <!--<fo:conditional-page-master-reference master-reference="first" page-position="first"/>--> 
       <!--<fo:conditional-page-master-reference master-reference="terms" page-position="only"/>--> 
       <!--<fo:conditional-page-master-reference master-reference="rest" page-position="rest"/>--> 
      <!--</fo:repeatable-page-master-alternatives>--> 
      <fo:single-page-master-reference master-reference="first"/> 
      <fo:single-page-master-reference master-reference="terms"/> 
      <fo:repeatable-page-master-alternatives> 
       <fo:conditional-page-master-reference master-reference="rest" page-position="rest"/> 
      </fo:repeatable-page-master-alternatives> 
     </fo:page-sequence-master> 

    </fo:layout-master-set> 
    <!-- end: defines page layout --> 

    <!-- actual layout --> 
    <fo:page-sequence master-reference="Statement" id="stmt"> 

     <fo:static-content flow-name="stmt-header"> 
      <th:block th:include="header-logo :: header-logo"/> 
     </fo:static-content> 

     <fo:static-content flow-name="stmt-header-1"> 
      <th:block th:include="header-logo :: header-logo-1"/> 
     </fo:static-content> 

     <fo:static-content th:with="footer_margin_left=1.7" flow-name="stmt-footer"> 
      <th:block th:include="footer"/> 
     </fo:static-content> 

     <fo:static-content th:with="footer_margin_left=0" flow-name="stmt-footer-1"> 
      <th:block th:include="footer"/> 
     </fo:static-content> 

     <fo:static-content flow-name="stmt-terms"> 
      <th:block th:include="stmt_terms :: stmt-terms"/> 
     </fo:static-content> 

     <fo:flow flow-name="xsl-region-body"> 
      <th:block th:include="${templateLayoutContent} :: stmt-body"/> 
     </fo:flow> 



    </fo:page-sequence> 

</fo:root> 

와 FO 파일입니다 수 누군가 나 좀 도와 줘?

답변

1

나는 이것을 찾고 있다고 생각합니다 : force-page-count="even" 이렇게하면 페이지 시퀀스에 항상 짝수 페이지가 표시됩니다. 사실 두 번째 페이지가 있어야합니다. 페이지에 내용이 없으면 조건부 페이지 마스터의 blank-or-not-blank 속성에 의해 사용 된 페이지 마스터 및 정적 내용을 지정할 수 있습니다.

+1

Force-page-count = "even"은 두 번째 페이지가 항상 존재하는지 확인합니다. 하지만, 오버플로가있을 때 (1 페이지에서 3 페이지까지) 네 번째 페이지가 없어야합니다 (비어있게됩니다) –

+0

완벽한 솔루션이 두 가지가 있습니다. 위의 것이 첫 번째 것입니다. 두 번째는 break-after = "even-page"속성을 가진 fo : 블록을 추가하는 것입니다. 두 가지 해결책 모두 당신이 이미 알아 차린 것과 같은 문제가 있습니다. 나는 xsl이 페이지를 인식하지 못하고 최소 페이지를 정의 할 수 없기 때문에이를 고칠 수 있다고 생각하지 않는다. –

+0

정적 페이지는 얼마나 정적입니까? PDF 또는 이미지 일 수 있습니까? –

관련 문제