0

I am generating a pdf which group accounts first by Country and then by property.

For this i have used nested repeat tag.I want a page break for every country i.e. a page break for every outer repeat tag.

Please advice.

<apex:page controller="AccountSummaryReportController" action="{!loadKeyAccounts}" renderAs="pdf" >

    <apex:sectionHeader title="Account Summary Report as of : {!TODAY()}"  description="This Report Shows Accounts modified in last 31 days"/>
    <apex:form >
        <apex:pageBlock >
            <apex:repeat value="{!objectMap }" var="ProgNameKey">
                <apex:pageBlock title="{!ProgNameKey}" >
                    <apex:repeat value="{!objectMap [ProgNameKey]}" var="PlanNameKey">
                        <apex:outputPanel styleClass="grey" layout="block">
                            <apex:pageBlockSection title="{!PlanNameKey}" columns="1" >
                                <apex:pageBlockTable value="{!objectMap [ProgNameKey][PlanNameKey]}" var="lstGrnRate"  border="1" columnsWidth="20%,5%,75%" >
                                    <apex:column value="{!lstGrnRate.Account__r.Name}"/>
                                    <apex:column footerClass="reviewStatusHeader" HeaderValue="Summary Status" headerClass="centHeader">
                                       <apex:image value="{! If(lstGrnRate.Status__c=="Red" ,URLFOR($Resource.Red),
                                                      If(lstGrnRate.Status__c=="Green",URLFOR($Resource.Green), URLFOR($Resource.Amber))) }" width="40" height="30" style="float:centre;"/>
                                     </apex:column>
                                    <apex:column value="{!lstGrnRate.Account_Summary__c}"/>
                                </apex:pageBlockTable>
                            </apex:pageBlocksection>
                        </apex:outputPanel>
                    </apex:repeat>
                </apex:pageBlock>
            </apex:repeat>
        </apex:pageBlock>
    </apex:form>
</apex:page>
1

Use

page-break-after: always;

Css to break the page in PDF

            </apex:repeat>
      </apex:pageBlock>
  <p style="page-break-after: always;" ></p>
</apex:repeat>
| improve this answer | |
  • This works.Thanks.But i am getting an extra blank page at the end.Is there a way to remove that. – Samir Aug 22 '16 at 9:12
  • 1
    You can use some css hack like if this is your last page then use` display:none css` in this` p tag` – Tushar Sharma Aug 22 '16 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.