+ Start a Discussion
Mitesh SuraMitesh Sura 

PDF page break

I have a simple VF page that is rendered as PDF. I am able to page break, but it is not consistent. Please see below link. All highlighted part is just one line and it should be shown next to description. But it does not and make it difficult to read for end customer as description is on next page, but pricing, and other details are on previous page. 

 

PDF image: https://docs.google.com/file/d/0B78Ci2ATrMf8UjZCdXkwWFFpQk0/edit?usp=sharing

 

VF page

     <apex:outputPanel rendered="{!columns.size>0}">
                <table style="width:100%; -fs-table-paginate: paginate; background-color:#C6C6C6;">                     
                    <!-- Column Headers -->
                    <thead>
                        <tr>    
                            <apex:repeat value="{!columns}" var="c">
                                <th>{!c.Name}</th>                          
                            </apex:repeat>
                        </tr> 
                    </thead>

                    <!-- Rows -->  
                    <apex:repeat value="{!pdf_items}" var="i"> 
                    	<!-- Item -->
                        <tr>  
                            <td>
                                {!i.lineNumber}
                            </td>
                            <apex:repeat value="{!columns}" var="c">
                                <td>                                    
                                    <!-- Item -->            
                                    <apex:outputPanel layout="block" >
			                        	<apex:outputText value="{!i.sObj[c.Quote_line_item_API_name__c])}" escape="false" />
                                    </apex:outputPanel>  
                                </td>
                            </apex:repeat>   
                        </tr>
                    </apex:repeat> 
                </table>  
            </apex:outputPanel>

 

 

I found one article that describes the issue http://cloud-computing-expert.blogspot.com/2012/04/generating-salesforcecom-quotes-pdf_11.html 

 

Any suggestions what can be done? Thank you for your time. 

souvik9086souvik9086

Check the following link if it helps

 

http://mindfiresfdcprofessionals.wordpress.com/2013/08/10/page-break-functionality-for-printing-record-detail-page/

 

If this post is helpful please throw Kudos.If this post solves your problem kindly mark it as solution.

Thanks

Mitesh SuraMitesh Sura
Thanks Souvik for sharing that, but that is very simple page with each line on new page. It is kind of static, as they are blindly printing new record on new page.

If you look at the PDF image I posted, you will see it is dynamic in nature, I have no clue what the records will look like and it is fine if it breaks based on where the page ends, but it should print new line on new page. You will notice some info is printed on previous page and some on next page.

Any thoughts? Thanks for your time.
liron169liron169

Hi,

 

Try to put the section you don't want to break page inside (try with page-break-after\page-break-before, depend on your needs):

 

<div style="page-break-after:avoid;"> 
<!-- your code here --> </div>
Mitesh SuraMitesh Sura
Liron,

I gave that a shot but nothing changed, then I found this article on w3schools.

http://www.w3schools.com/cssref/pr_print_pageba.asp

Firefox, Chrome, and Safari do not support the property values "avoid", "left", or "right".