2012-01-20 2 views
4

피사 문서의 첫 페이지에는 한 프레임, 다른 모든 페이지에는 바닥 글이 표시되는 데 문제가 있습니다. lastPage 아이디어를 here에서 적용하려고 시도했지만 행운이 없습니다.pisa/xhtml2pdf로 첫 번째 및 연속 페이지에 다른 바닥 글 표시

가능합니까? <pdf:nextpage />은 문서가 여러 페이지에 걸쳐 있거나 흐를 수없는 긴 테이블을 가지고 있기 때문에 여기서는 옳은 것 같지 않습니다. <pdf:nextframe /> 더하기 첫 페이지 만의 프레임이 유망 해 보이지만 정확히 어떻게 사용해야하는지 잘 모르겠습니다. 현재 내가 (간결 냈다) 한

:

<style type="text/css"> 
    @page { 
    margin: 1cm; 
    margin-bottom: 2.5cm; 
    @frame footer { 
     -pdf-frame-content: footerFirst; 
     -pdf-frame-border: 1; 
     bottom: 2cm; 
     margin-left: 1cm; 
     margin-right: 1cm; 
     height: 1cm; 
    } 
    @frame footer { 
     -pdf-frame-content: footerOther; 
     bottom: 2cm; 
     margin-left: 1cm; 
     margin-right: 1cm; 
     height: 1cm; 
} 
</style> 
<body> 
    <table repeat="1"> 
    <!-- extra long table here --> 
    </table> 
    <div id="footerContent">This is a footer</div> 
    <!-- what goes here to switch frames after the first page? --> 
    <div id="footerOther"></div> 
</body> 

이 각 페이지에 동일한 바닥 글을 배치합니다. 각 연속 페이지에 동일한 공간이 있어야하지만 프레임에 내용이 없습니다.

답변

5

추가 레이아웃을 이름으로 정의한 다음 xttml2pdf가 nexttemplate 태그를 사용하여 명시 적으로 전환하도록 지정할 수 있습니다. 나는 최근에 내 첫 페이지에는 헤더가 없지만 모든 후속 페이지에 헤더를 표시했습니다.

당신은 아마 다음과 같이 두 개의 서로 다른 페이지에 @page 정의를 변경해야합니다

:

<style type="text/css"> 
    @page { 
    margin: 1cm; 
    margin-bottom: 2.5cm; 
    @frame footer { 
     -pdf-frame-content: footerFirst; 
     -pdf-frame-border: 1; 
     bottom: 2cm; 
     margin-left: 1cm; 
     margin-right: 1cm; 
     height: 1cm; 
    } 
} 

@page innerpages { 
    margin: 1cm; 
    margin-bottom: 2.5cm; 
    @frame footer { 
     -pdf-frame-content: footerOther; 
     bottom: 2cm; 
     margin-left: 1cm; 
     margin-right: 1cm; 
     height: 1cm; 
    } 
} 
</style> 

그런 다음, HTML에 당신이 다른 레이아웃으로 전환과 같은 태그를 사용하고자하는 경우

<pdf:nexttemplate name="innerpages"/> 

다음 페이지 (그리고 템플릿을 다시 변경할 때까지 후속 페이지)는 '기타'바닥 글과 함께 내부 페이지 레이아웃을 사용합니다.

+0

반대 문제가 있습니다. 마지막 페이지에서 바닥 글을 변경하십시오. 비슷한 해결책이 있습니까? 감사합니다. – Don

+0

@Don : 동일한 해결책입니다. 마지막 페이지에 대해 다른 템플릿을 만들고 위의 태그를 사용하여 마지막 페이지보다 먼저 전환하십시오. –

+0

하지만 마지막 페이지 전에 페이지에 있는지 어떻게 알 수 있습니까? (얼마나 많은 행이 한 페이지에 들어갈 수 있는지 알 수 없으므로 문서가 몇 페이지인지 예측할 수 없습니다 ...) – Don