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 visual force 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 ,

 

 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.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>

 

 

Pradeep_NavatarPradeep_Navatar

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

 

@page

  {

    size:landscape;

    margin-top:10%;

    .

    .

    .

 

    }

 

Hope this helps.

venkatasubhashkvenkatasubhashk

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

emilyjonesemilyjones

I need the answer to this also. 

 

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

venkatasubhashkvenkatasubhashk

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, 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)];

 

paeg:

 <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!
James Mitchell 56James Mitchell 56
Same for me. 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 RE: https://www.timesunion.com/marketplace/article/best-crypto-casinos-17622100.php page breaks https://salesforce.stackexchange.com/questions/55591/rendering-a-visualforce-page-as-pdf-and-force-page-breaks. I didn't get it from previous salesforcer.
polaris gleampolaris gleam
The answer to any question always comes unexpectedly and the decision in this case will be correct. I was also looking for the right solution and found it. And while solving the problem, I found a reliable service. Play and win online casino slots https://jennycasino.com/ and get game bonuses