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
Vinod KumarVinod Kumar 

Render as pdf problem

Hi all i tried to render my page in pdf format. I have apex:repeat tag through that i need to populate 10 columns, but my pdf page is populating 5 columns even though i given page size everything still not showing . I am getting the problem in Assessment result detail section, this is my code :

 

<apex:page controller="TestController"  sidebar="false" renderAs="pdf">
    <style>
        @page {
            size:8.5in 11in;
            margin-top: 2.0cm;
            margin-left: 0cm;
            margin-right: 1.5cm;
            margin-bottom: 2cm;
        }
        body {font-family: Arial Unicode MS;}
        
    </style>
    <apex:include pageName="avCssInclude" />
    <apex:form id="frm" >
        <apex:pageBlock id="pgb">
            <table class="avDetailPaneTitle">
                <tr>
                    <td valign="middle" width="64px" height="64px"
                        class="assessment-icon64x64"></td>
                    <td colspan="1" valign="middle" height="64px">
                        <h1>{!reportTitleLabel}</h1>
                        <h2>{!reportTitle}</h2>
                    </td>
                </tr>
            </table>
            
                <!-- Assessment Target  -->
            <div id="target">
            <apex:pageblockSection title="Assessment Target">
                <apex:outputPanel rendered="{!isRisk}">
                    <table  width="100%" cellpadding="0" cellspacing="0">
                        <tr style="height:20px ;">
                            <td width="15%">Assessment</td>
                            <td width="25%"><apex:outputLink value="/{!assessment.Id}">{!assessment.Title__c}</apex:outputLink></td>
                            <td width="12%"></td>
                            <td width="30%">Inherent Risk Level</td>
                            <td width="23%">
                                <apex:outputLabel value="{!assementRiskScoreDisplay}"
                                styleClass="avScoreBox"
                                style="color: {!assessment.Inherent_Risk_Color__c}; font-weight:bold;" />
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">Target</td>
                            <td width="25%"><apex:outputLabel value="{!assessment.Target_Asset__r.Name}" /></td>
                            <td width="12%"></td>
                            <td width="30%">Inherent Risk</td>
                            <td width="23%"><apex:outputText value="{!assessment.Inherent_Risk_Bar__c}" escape="false"/></td>
                        </tr>
                        <tr>
                            <td width="15%">Owner</td>
                            <td width="25%"><apex:outputField value="{!assessment.OwnerId}"/></td>
                            <td width="12%"></td>
                            <td width="30%">Controls Responded</td>
                            <td width="23%"><apex:outputText value="{!respndedCount}" /></td>
                        </tr>
                    </table>
                </apex:outputPanel>
                
                <apex:outputPanel rendered="{!isCompliance}">
                    <table  width="100%" cellpadding="0" cellspacing="0">
                        <tr style="height:20px ;" >
                            <td width="15%">Assessment</td>
                            <td width="25%"><apex:outputLink value="/{!assessment.Id}">{!assessment.Title__c}</apex:outputLink></td>
                            <td width="12%"></td>
                            <td width="30%">Inherent Compliance Level</td>
                            <td width="23%">
                                <apex:outputLabel value="{!assementComplianceScoreDisplay}"
                                styleClass="avScoreBox"
                                style="color: {!assessment.Inherent_Compliance_Color__c}; font-weight:bold;" />
                            </td>
                        </tr>
                        <tr style="height:20px">
                            <td width="15%">Target</td>
                            <td width="25%"><apex:outputLabel value="{!assessment.Target_Asset__r.Name}" /></td>
                            <td width="12%"></td>
                            <td width="30%">Inherent Compliance</td>
                            <td width="23%"><apex:outputText value="{!assessment.Inherent_Compliance_Bar__c}" escape="false"/></td>
                        </tr>
                        <tr style="height:20px">
                            <td width="15%">Owner</td>
                            <td width="25%"><apex:outputField value="{!assessment.OwnerId}"/></td>
                            <td width="12%"></td>
                            <td width="30%">Controls Responded</td>
                            <td width="23%"><apex:outputText value="{!respndedCount}" /></td>
                        </tr>
                    </table>
                </apex:outputPanel>
                
                <apex:outputPanel rendered="{!isComplianceRisk}" >
                    <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                            <td width="15%">Assessment</td>
                            <td width="25%"><apex:outputLink value="/{!assessment.Id}">{!assessment.Title__c}</apex:outputLink></td>
                            <td width="12%"></td>
                            <td width="30%">Target</td>
                            <td width="23%">
                                <apex:outputLabel value="{!assessment.Target_Asset__r.Name}" />
                            </td>
                        </tr>
                        <tr>
                            <td width="15%">Owner</td>
                            <td width="25%"><apex:outputField value="{!assessment.OwnerId}"/></td>
                            <td width="12%"></td>
                            <td width="30%">Controls Responded</td>
                            <td width="23%"><apex:outputText value="{!respndedCount}" /></td>
                        </tr>
                        <tr>
                            <td width="15%">Inherent Compliance Level</td>
                            <td width="25%">
                                <apex:outputLabel value="{!assementComplianceScoreDisplay}"
                                styleClass="avScoreBox"
                                style="color: {!assessment.Inherent_Compliance_Color__c}; font-weight:bold;" />
                            </td>
                            <td width="12%"></td>
                            <td width="30%">Inherent Compliance</td>
                            <td width="23%"><apex:outputText value="{!assessment.Inherent_Compliance_Bar__c}" escape="false"/></td>
                        </tr>
                        <tr>
                            <td width="15%">Inherent Risk Level</td>
                            <td width="25%">
                                <apex:outputLabel value="{!assementRiskScoreDisplay}"
                                styleClass="avScoreBox"
                                style="color: {!assessment.Inherent_Risk_Color__c}; font-weight:bold;" />
                            </td>
                            <td width="12%"></td>
                            <td width="30%">Inherent Risk</td>
                            <td width="253%"><apex:outputText value="{!assessment.Inherent_Risk_Bar__c}" escape="false"/></td>
                        </tr>
                    </table>
                </apex:outputPanel>
            </apex:pageblockSection>
            </div>
            <!-- Assessment Result Summary -->
            <table width="100%">
                <tr>
                    <td>Assessment Result Summary</td>
                </tr>
            </table>
            <apex:outputPanel rendered="{!isCompliance}">
                <table width="100%">
                    <tr>
                        <th width="20%">Authority Document</th>
                        <th width="30%">Citation</th>
                        <th width="25%">Compliance Level</th>
                        <th width="25%">Compliance</th>
                    </tr>
                    <apex:repeat value="{!summaryResultsList}" var="summaryResult">
                        <tr>
                            <td width="20%">
                                <apex:outputLink value="/{!summaryResult.authDocId}"
                                      target="_blank">{!summaryResult.authDocName}</apex:outputLink>
                            </td>
                            <td width="30%">
                                <apex:outputLink value="/{!summaryResult.cSummaryResult.Citation__r.Id}"
                                      target="_blank">{!summaryResult.cSummaryResult.Citation__r.Name}</apex:outputLink>
                            </td>
                            <td width="25%">
                                <apex:outputLabel value="{!summaryResult.complianceScoreDisplay}"
                                    styleClass="avScoreBox"
                                    style="color: {!summaryResult.cSummaryResult.Inherent_Compliance_Color__c}; font-weight:bold;" />
                            </td>
                            <td width="25%">
                            
                            </td>
                        
                        </tr>
                    </apex:repeat>
                </table>
            </apex:outputPanel>
            
            <apex:outputPanel rendered="{!isRisk}">
                <table width="100%">
                    <tr>
                        <th width="20%">Authority Document</th>
                        <th width="30%">Citation</th>
                        <th width="25%">Risk Level</th>
                        <th width="25%">Risk</th>
                    </tr>
                    <apex:repeat value="{!summaryResultsList}" var="summaryResult">
                        <tr>
                            <td width="20%">
                                <apex:outputLink value="/{!summaryResult.authDocId}"
                                      target="_blank">{!summaryResult.authDocName}</apex:outputLink>
                            </td>
                            <td width="30%">
                                <apex:outputLink value="/{!summaryResult.cSummaryResult.Citation__r.Id}"
                                      target="_blank">{!summaryResult.cSummaryResult.Citation__r.Name}</apex:outputLink>
                            </td>
                            <td width="25%">
                                <apex:outputLabel value="{!summaryResult.riskScoreDisplay}"
                                    styleClass="avScoreBox"
                                    style="color: {!summaryResult.cSummaryResult.Inherent_Risk_Color__c}; font-weight:bold;" />
                            </td>
                            <td width="25%">
                                
                            </td>
                        
                        </tr>
                    </apex:repeat>
                </table>
            </apex:outputPanel>
            
            <apex:outputPanel rendered="{!isComplianceRisk}">
                <table width="100%">
                    <tr>
                        <th width="15%">Authority Document</th>
                        <th width="25%">Citation</th>
                        <th width="12%">Compliance Level</th>
                        <th width="12%">Risk Level</th>
                        <th width="18%">Compliance</th>
                        <th width="18%">Risk</th>
                    </tr>
                    <apex:repeat value="{!summaryResultsList}" var="summaryResult">
                        <tr>
                            <td width="15%">
                                <apex:outputLink value="/{!summaryResult.authDocId}"
                                      target="_blank">{!summaryResult.authDocName}</apex:outputLink>
                            </td>
                            <td width="25%">
                                <apex:outputLink value="/{!summaryResult.cSummaryResult.Citation__r.Id}"
                                      target="_blank">{!summaryResult.cSummaryResult.Citation__r.Name}</apex:outputLink>
                            </td>
                            <td width="12%">
                                <apex:outputLabel value="{!summaryResult.complianceScoreDisplay}"
                                    styleClass="avScoreBox"
                                    style="color: {!summaryResult.cSummaryResult.Inherent_Compliance_Color__c}; font-weight:bold;" />
                            </td>
                            <td width="12%">
                                <apex:outputLabel value="{!summaryResult.riskScoreDisplay}"
                                    styleClass="avScoreBox"
                                    style="color: {!summaryResult.cSummaryResult.Inherent_Risk_Color__c}; font-weight:bold;" />
                            </td>
                            <td width="18%">
                                
                            </td>
                            <td width="18%">
                                
                            </td>
                        </tr>
                    </apex:repeat>
                </table>
            </apex:outputPanel>
            
                    <!-- Assessment Result Details -->            
            <span style="font-weight: bold;font-size: 20px;">Control Results Details</span>
           
            <table width="100%" >
                <tr>
                    <th >
                        Citation
                    </th>
                    <th>
                        Control
                    </th>
                    <th>
                        Compliance Level
                    </th>
                    
                    <th>
                        Response
                    </th>
                    <th>
                        Comment
                    </th>
                    <th>
                        Evidence
                    </th>
                    <th>
                        Responded By
                    </th>
                    <th>
                        Response Time
                    </th>
                </tr>
                <apex:repeat value="{!resultsList}" var="result">
                    <tr>
                        <td >
                            <apex:outputLink value="/{!result.cResult.Citation__r.Id}"
                                target="_blank">{!result.cResult.Citation__r.Name}</apex:outputLink>
                        </td>
                        <td >
                            <apex:outputLink value="/{!result.cResult.Control__r.Id}"
                                target="_blank">{!result.cResult.Control__r.Name}</apex:outputLink>
                        </td>
                        <td>
                            <apex:outputLabel value="{!result.complianceScoreDisplay}"
                                styleClass="avScoreBox"
                                style="color: {!result.cResult.Inherent_Compliance_Color__c}; font-weight:bold;" />
                        </td>
                        
                        <td>
                            <table>
                                <apex:repeat value="{!result.questionList}" var="question">
                                    <tr>
                                        <td>
                                            <apex:outputText value="{!question.check.Question__c}" />
                                        </td>
                                        <td>
                                            <apex:outputPanel rendered="{!if((question.check.Display_Layout__c == 'Radio' || question.check.Display_Layout__c == 'Drop Down' || question.check.Display_Layout__c == 'Checkbox'),true,false)}">
                                                <apex:outputText value="{!question.answerChoice}" style="font-weight: bold;"/>
                                            </apex:outputPanel>
                                            <apex:outputPanel >
                                                <apex:outputText value="{!question.multiAnswerChoice}" style="font-weight: bold;"/>
                                            </apex:outputPanel>
                                            <apex:outputPanel rendered="{!if((question.check.Display_Layout__c == 'Text Area' || question.check.Display_Layout__c == 'Simple Text'),true,false)}">
                                                <apex:OutputText value="{!question.selectedVal}" style="font-weight: bold;"/>
                                            </apex:outputPanel>
                                        </td>
                                    </tr>
                                </apex:repeat>
                            </table>
                        </td>
                        <td >
                            <apex:outputField value="{!result.cResult.Last_Comment__c}"/>
                        </td>
                        <td >
                            <apex:dataList value="{!result.documentLinksList1}" var="doc" type="none">
                                <apex:outputLink value="/{!doc.Document__r.Id}" target="_blank">{!doc.Document__r.Name}</apex:outputLink>
                            </apex:dataList>
                        </td>
                        <td >
                            <apex:outputField value="{!result.cResult.LastModifiedById}"/>
                        </td>
                        <td >
                            <apex:outputLabel value="{!result.cResult.Last_Execution_Time__c}"/>
                        </td>
                    </tr>
                </apex:repeat>
                
            </table>
            
        </apex:pageBlock>
        
    </apex:form>
</apex:page>

 

Please let me know any mistake.

colemabcolemab

If you turn renderas="PDF" off, does it render correctly?  If so the issue with the PDF rendering.  If not, it is something else in your code and/or data.