How to break a visual force PDF containing a table of Line items
12-31-2010 07:24 AM
the following is my vf code:
<apex:page Controller="MyController32" RenderAs="pdf" >
<html>
<head>
<style type="text/css" media="print">
@media print
{
table {page-break-inside:auto }
tr { page-break-inside:avoid; page-break-after:auto }
thead { display:table-header-group }
}
@page {
@PageBreak{
page-break:always;
page-break-inside:avoid;
}
size:landscape;
@bottom-right {
content: "Page " counter(page) "of " counter(pages);
}
@top-center {
content: element(header);
}
@bottom-center {
content: element(footer);
}
}
div.header {
padding: 10px;
position: running(header);
}
div.footer {
display: block;
padding: 1px;
position: running(footer);
}
</style>
</head>
<!--header-->
<div class="header">
<table border='0'>
<tr>
<td height = '100'>
<apex:image id="theImage" value="{!$Resource.harlanlogo}" width="136" height="65"/>
</td>
</div>
<!--table-->
<body>
<div>
<table border ='1'>
<thead>
<tr>
<th>Number</th>
<th>M/F</th>
<th>Product</th>
<th>Description</th>
<th>Purpose</th>
<th>Item Price </th>
<th>Final Price </th>
<th>Packing Costs</th>
<th>Freight Costs </th>
<th>Total Costs</th>
</tr>
</thead>
<tbody>
<tr>
<apex:repeat value="{!Quoteproduct}" var="a">
<tr style="page-break-after:auto;">
<td>{!FLOOR(a.Quantity__c)}</td>
<td>{!a.Sex__c}</td>
<td>{!a.Product__r.Description}</td>
<td>{!a.Product__r.Name } {!a.Age_Weight__c }</td>
<td>{!a.Purpose__c}</td>
<td>{!IF((a.Product__r.Family =='Package'||a.Product__r.Family=='Freight'),0,a.S ales_Price__c)} </td>
<td>{!IF((a.Product__r.Family =='Package'||a.Product__r.Family=='Freight'), 0 ,a.Discounted_Price__c)} </td>
<td>{!IF((a.Product__r.Family =='Package'),a.Sales_Price__c,0)}</td>
<td>{!IF((a.Product__r.Family =='Freight'),a.Sales_Price__c,0)} </td>
<td>€ {!a.Total_Price_QP__c}</td>
</tr>
</apex:repeat>
</tr>
</tbody>
</table>
</div>
</body>
</html>
</apex:page>
Re: How to break a visual force PDF containing a table of Line items
02-03-2011 08:54 PM
Hi
I have done a Work around for that,i wrote multiple SOQL queries in my controller for getting 10 opp lines and 20 opp lines ,and i used the apex tag as follows
count_line__c is rollup count of quotelines on quote
controller:
QP1 = [select id,name,Quantity__c,product__c, Prod
from Quote_Product__c where Quote__c =:Q.Id and
QP2 = [select id,name,Quantity__c,product__c, Prod
from Quote_Product__c where Quote__c =:Q.Id and
paeg:
<apex:outputPanel rendered="{!QUOTE.Count_line__c >15}"> "
