+ Start a Discussion
Uves RavatUves Ravat 

Page break on visual force page

Hi, i am creating page breaks between serveral invoices. This is currently working but the problem is that it always create a blank page at the end...how can i avoid this.

 

here is the code i have using. for example if i have 4 invoice page it creates 5 pages

 

<apex:repeat value="{!invoicePageList}" var="invoicePage">
<c:SalesInvoicePage4 salesInvoicePage="{!invoicePage}" />
<div style="page-break-before: always;">&nbsp;</div>
</apex:repeat>

sfdcfoxsfdcfox

Wrap the component within a div, and use the "page-break-after: always" css instead of "page-break-before: always" like you're using now. The current CSS causes the last page to have a single whitespace character, thus triggering the new page. Assuming there is no markup past the repeat tag, you won't have a blank page; if you do, then that markup will automatically appear on the start of the next page.

Uves RavatUves Ravat

am not sure if i did it correctly but i did as followers 

 

on the component page just after i declared the component i created the div

<div class="name of css field">

 

the css field will be on the visualforce place where i declare the component

 

that didnt page break after each invoice