function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VENKAT32VENKAT32 

How to break a page in VF PDF containing a table of Line items

 

hi 
i got the similar problem to break a PDF page , i have a quote with line items table, when the line items are more the table automatically going to second page but its is overlapping with the header on the second page , i want the table to be continued after the header ,
<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.Sales_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>
hi 
i got the similar problem to break a PDF page , i have a quote with line items table, when the line items are more the table automatically going to second page but its is overlapping with the header on the second page , i want the table to be continued after the header ,
in your previous post u mentioned about the wrapper class,i am unable to get that please help me....  
<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.Sales_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>

 

 

dmchengdmcheng

You'll probably get more responses if you post this on the Visualforce board.

venkatasubhashkvenkatasubhashk

ya i checked that ,some one modified the code form the actual one !!