+ Start a Discussion

How to break a visual force PDF containing a table of Line items


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 ,


 the following is my vf code:



<apex:page Controller="MyController32" RenderAs="pdf" >
<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 {



@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);





<div class="header">
<table border='0'>
<td height = '100'>
<apex:image id="theImage" value="{!$Resource.harlanlogo}" width="136" height="65"/>

<table border ='1'>
<th>Item Price </th>
<th>Final Price </th>
<th>Packing Costs</th>
<th>Freight Costs </th>
<th>Total Costs</th>


      <apex:repeat value="{!Quoteproduct}" var="a">
<tr style="page-break-after:auto;">

<td>{!a.Product__r.Name } {!a.Age_Weight__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>







Under the @ page{ } use the margin-top:10%; style :












Hope this helps.


Thanks Pradeep, i got that, Is there a way to get the Table column headings on the second page also..


I need the answer to this also. 


thead { display : table-header-group;}  is not working




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



QP1 = [select id,name,Quantity__c,product__c, Product__r.Name,S_no__c, Product__r.Family ,Product__r.Description , Age_Weight__c ,Purpose__c,sales_Price__c ,Discounted_Price__c,Sex__c, Total_Price_QP__c 
  from Quote_Product__c  where Quote__c =:Q.Id and (S_no__c >= 16 and S_no__c<35)];
QP2 = [select id,name,Quantity__c,product__c, Product__r.Name,S_no__c, Product__r.Family ,Product__r.Description , Age_Weight__c ,Purpose__c,sales_Price__c ,Discounted_Price__c,Sex__c, Total_Price_QP__c 
  from Quote_Product__c  where Quote__c =:Q.Id and (S_no__c >= 35 and S_no__c<=53)];



 <apex:outputPanel rendered="{!QUOTE.Count_line__c >15}"> "
Frank Lucido 26Frank Lucido 26
Hello, Is it the same as with apex:panelGrid? I wanted to display records on the next row in the table. But the answers I got from the Force com official support didn't help me at all.
Frank Lucido 26Frank Lucido 26
I've been searching for the answers and solutions on stackexchange, but my case seems to be quite different - and the discussions are closed.
Rendering a Visualforce page as PDF and force (https://salesforce.stackexchange.com/questions/55591/rendering-a-visualforce-page-as-pdf-and-force-page-breaks) editor (https://writemyessaytoday.net/) page breaks (https://salesforce.stackexchange.com/questions/55591/rendering-a-visualforce-page-as-pdf-and-force-page-breaks).
Alex GamblerAlex Gambler
Yeah, that is true, I have been looking for the same answer and I may safely say that this one
https://salesforce.stackexchange.com/questions/55591/rendering-a-visualforce-page-as-pdf-and-force-page-breaks link (https://casinority.com/real-money/) works for me just perfectly, of course you may also try https://salesforce.stackexchange.com/questions/55591/rendering-a-visualforce-page-as-pdf-and-force-page-breaks. Good luck!