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
Heather_HansonHeather_Hanson 

PDF generation failed. Check the page markup is valid.

A few months ago, I was asked to add to our existing Visualforce page, two more pages that present the products chosen in a certain way.  Our products got labelled "NQP" if it was equipment and "HPX, HPS, or LIC" if it was a service, and "CNT" if it was an activation fee.

Rendering the page to PDF has been termpermental ever since. Sometimes it works and sometimes I get the error message.  I have checked and ensured that each product has it's label as I know that was the cause of the problem at times.  Sometimes when the problem occurs, I find just removing all the products and picking them all again helps, but right now I'm currently stuck on fixing one and also would like for this problem to just not happen anymore.

I read that empty columns cause problems on the render PDF, so I fixed that, but I'm still having issues.  I think I have narrowed the issue down to one of the two pages that I had to add.  Here is the code for the HTML version (we have a button in the HTML that is linked to the PDF rendered version).
<table class="column_ttl2" style="width:100%;">
                            <tr>
                            <td style="width:10%;" class="tac">TR Code</td>                                
                            <td style="width:5%;">Qty</td>
                            <td class="tal">Description</td>
                            <td style="width:15%;" class="tac">Unit Price</td>
                            <td style="width:15%;" class="tac">Totals</td>
                            </tr>
                        </table>
                 <apex:pageBlock >
                         <apex:pageblocktable value="{!Opportunity.opportunityLineItems}" var="OP" styleClass="items_tbl">
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="TR Code" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText value="{!OP.TR_Service_Group__c}"/></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblQty}" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OP.Quantity}" /></apex:outputText></apex:column>
                            <apex:column headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'ENGLISH'}"></apex:column>
                            <apex:column headerValue="Description" value="{!OP.Product2.Product_name_french__c}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'FRENCH'}"></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblUnitPrice}" value="{!OP.UnitPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblSubTot}" value="{!OP.TotalPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                     </apex:pageblocktable>
                     
                        <apex:outputPanel rendered="{!strServiceType = 'HPBX'}">
                            <apex:pageblocktable value="{!Opportunity}" var="OPP" headerClass="hidden" >
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unifon_Services__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unifon_Services__c}"/>  
                            </apex:pageblocktable>
                        </apex:outputPanel>
                     
                        <apex:outputPanel rendered="{!strServiceType ='Unifôn IP Connect' && CONTAINS(Opportunity.Financing_Term__c, '36')}">
                            <apex:pageblocktable value="{!Opportunity}" var="OPP" headerClass="hidden" >
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_36__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_36__c}"/>  
                            </apex:pageblocktable>
                        </apex:outputPanel>   

                        <apex:outputPanel rendered="{!strServiceType ='Unifôn IP Connect' && CONTAINS(Opportunity.Financing_Term__c, '60')}">
                            <apex:pageblocktable value="{!Opportunity}" var="OPP" headerClass="hidden" >
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_60__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_60__c}"/>  
                            </apex:pageblocktable>
                        </apex:outputPanel> 
                     
                      <apex:pageblocktable value="{!Opportunity}" var="OPP" headerClass="hidden" >
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >CNT</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Interconnection_Installation_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Interconnection: Installation</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Interconnection_Installation__c}"/>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Interconnection_Installation__c}"/>
                     </apex:pageblocktable>
Here is the PDF version.  
 
<table class="column_ttl" style="width:98.7%;">
                            <tr>
                            <td style="width:10%;" class="tac">TR Code</td>                                
                            <td style="width:5%;">Qty</td>
                            <td class="tal">Description</td>
                            <td style="width:15%;" class="tac">Unit Price</td>
                            <td style="width:15%;" class="tac">Totals</td>
                            </tr>
                        </table>
                        

                        <apex:dataTable value="{!Opportunity.opportunityLineItems}" var="OP" style="width:98.7%">
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="TR Code" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText value="{!OP.TR_Service_Group__c}"/></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblQty}" headerClass="column_ttl tac" styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OP.Quantity}" /></apex:outputText></apex:column>
                            <apex:column headerValue="Description" value="{!OP.PriceBookEntry.Name}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'ENGLISH'}"></apex:column>
                            <apex:column headerValue="Description" value="{!OP.Product2.Product_name_french__c}" headerClass="column_ttl" styleClass="tbl_bdr" rendered="{!OP.TR_Service_Group__c = 'NQP' && Opportunity.Language__c = 'FRENCH'}"></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblUnitPrice}" value="{!OP.UnitPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                            <apex:column rendered="{!OP.TR_Service_Group__c = 'NQP'}" headerValue="{!lblSubTot}" value="{!OP.TotalPrice}" headerClass="column_ttl tac" styleClass="tbl_bdr tar" style="width:15%;"></apex:column>
                        </apex:dataTable>
                        
                        <apex:outputPanel rendered="{!strServiceType = 'HPBX'}">    
                            <apex:dataTable value="{!Opportunity}" var="OPP" headerClass="hidden"  style="width:98.7%">
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unifon_Services__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unifon_Services__c}"/>  
                            </apex:dataTable>
                        </apex:outputPanel>

                        <apex:outputPanel rendered="{!strServiceType ='Unifôn IP Connect' && CONTAINS(Opportunity.Financing_Term__c, '36')}">    
                            <apex:dataTable value="{!Opportunity}" var="OPP" headerClass="hidden"  style="width:98.7%">
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_36__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_36__c}"/>  
                            </apex:dataTable>
                        </apex:outputPanel>

                        <apex:outputPanel rendered="{!strServiceType ='Unifôn IP Connect' && CONTAINS(Opportunity.Financing_Term__c, '60')}">    
                            <apex:dataTable value="{!Opportunity}" var="OPP" headerClass="hidden"  style="width:98.7%">
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >HPX+HPS</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Prepaid_Unifon_Services_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Prepaid Unifôn Services</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_60__c}"/>  
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Prepaid_Unif_n_Service_60__c}"/>  
                            </apex:dataTable>
                        </apex:outputPanel>    
    
                            <apex:dataTable value="{!Opportunity}" var="OPP" headerClass="hidden" style="width:98.7%">
                                <apex:column styleClass="tbl_bdr tac" style="width:10%;"><apex:outputText >CNT</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tac" style="width:5%;"><apex:outputText value="{0, number,###,###,##0}"><apex:param value="{!OPP.TR_Interconnection_Installation_Qty__c}" /></apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tal" ><apex:outputText >Interconnection: Installation</apex:outputText></apex:column>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Interconnection_Installation__c}"/>
                                <apex:column styleClass="tbl_bdr tar" style="width:15%;" value="{!OPP.TR_Interconnection_Installation__c}"/>
                            </apex:dataTable>

Any suggestions for improvement or trouble shooting would be greatly appreciated!