1

I have a opportunitylineItem list, so I create a visualforce email template to send like attachment the table with the opportuntiy products.

I need a dynamically page break if I have more than 6 rows in first page and 10 in subseq

I found this https://developer.salesforce.com/page/Creating_Professional_PDF_Documents_with_CSS_and_Visualforce

But the code for me is confused.

So how can I resolve this issue?

Or somebody can help me too understand the code?

Thanks.

1 Answer 1

0

i have face the same scenario , i have achieved this using components , Below is the style sheet which i used in components and where i save it in static resource with the name as dynapdf @page {

@top-center {

content: element(header);

}

@bottom-left {

    content: element(footer);

}

}

div.header {

padding: 10px;

position: running(header);

}

div.footer {

display: block;

padding: 5px;

position: running(footer);

}



.pagenumber:before {

content: counter(page);

}

.pagecount:before {

content: counter(pages);

}
</style>

<!----------------Component------------------->
<apex:component >
    <apex:attribute required="true"  type="string" name="type" description="specify header and footer type" />
        <apex:stylesheet value="{!$Resource.dynaPdf}"/>
            <div class="{!type}" style="background-color:rgb(175,117,161);box-shadow: 10px 10px 5px #888888;margin-bottom:200px">
            <apex:componentBody />
            </div>
</apex:component>

<-----------------Vfpage----------------------->
<apex:page standardStylesheets="false" id="pge" renderAs="pdf">
<c:dynapdfcomponent type="header" > 
  <div>My header</div>
</c:dynapdfcomponent>
  <c:dynapdfcomponent type="footer">
    <div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>
</c:dynapdfcomponent>
 <div class="content">
  <!----------------Your content goes here--------->
 </div>
</apex:page> 

so here instead of using page you can use your visual force email templates tags to work on it .. Hope this helps you :) Cheers

3
  • Worked, but the products in opportunityline item, stay up in header in second page, how can change that, this don't happened with the footer. If you can help me
    – lisyy
    Sep 30, 2014 at 16:57
  • I found, I have to do margin top in .css file. Thanks a lot for the help Vineeth
    – lisyy
    Sep 30, 2014 at 17:48
  • Hi lisyy ,that's great to hear ,happy to help you :) ,could please mark this as the best answer ,,and close this ..
    – Vineeth
    Sep 30, 2014 at 18:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .