1

I need to remove unnecessary Space from PDF (PDF is generated by VF page), I don't know why and from where it should be displayed,

Help me out from this issue.

please have a look into the screenshot of that PDF enter image description here

Here is my Visualforce Page Code :

<apex:outputPanel style="width:100%" rendered="{!NOT((Quote__c.NEFF_Subtotal__c)=0)}">
<table width="100%">
        <td colspan="1" style="font-size:16px;font-weight:bold;text-align:left">NEFF </td> 
</table>

<table width="100%">
    <!--<td colspan="6"> </td>-->

    <tr style="font-size:14px;font-weight:bold;text-align:center">
       <td align="center">Product Code</td>
       <td align="center">Product Description</td>
       <td align="center">Quantity</td>
       <td align="center">Colour</td>
       <td align="center">Unit Price</td>
       <td align="center">Amount</td>           
    </tr>

    <apex:variable value="{!1}" var="srn"/>
    <apex:repeat value="{!Quote__c.quote_Details__r}" var="quoD">
       <tr style="font-size:12px;text-align:left">     
            <td align="left" style="font-size:12px;text-align:left">
                 <apex:outputText rendered="{!If(quoD.Family_2__c == 'NEFF', true, false)}" value="{!quoD.Product__r.Name}" />
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{!quoD.Product__r.description}" rendered="{!If(quoD.Family_2__c == 'NEFF', true, false)}"/>
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{0, number, 0}" rendered="{!If(quoD.Family_2__c == 'NEFF', true, false)}">
                <apex:param value="{!quoD.Quantity__c}"/> 
                </apex:outputText>
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{!quoD.Product__r.Colour__c}" rendered="{!If(quoD.Family_2__c == 'NEFF', true, false)}"/>
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{0, number,£,##  0.00}" rendered="{!If(quoD.Family_2__c == 'NEFF', true, false)}"> <apex:param value="{!quoD.Unit_Price__c}"/> </apex:outputText>
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{0, number,£,##  0.00}" rendered="{!If(quoD.Family_2__c == 'NEFF', true, false)}"> <apex:param value="{!quoD.Amount__c}"/>  </apex:outputText>
            </td>
         </tr>

    </apex:repeat>        
    </table>
    <br/>
    </apex:outputpanel>
             <table width="100%">
             <td colspan="1" style="font-size:14px;font-weight:bold;text-align:right">NEFF Subtotal &nbsp;&nbsp;    
                <apex:outputText value="{0, number,   £,##  0.00}" rendered="{!If(NOT(Quote__c.NEFF_Subtotal__c == null), true, false)}"> <apex:param value="{!Quote__c.NEFF_Subtotal__c}"/> </apex:outputText> </td>
             </table>

    <br/> <br/>

1 Answer 1

2

Wrap the last table in an outputPanel and use the rendered attribute there instead of the outputText that is in the TD. Also move the last <br/> inside the new output panel as well as the last two breaks.

<apex:outPutPanel layout="none" rendered="{!If(NOT(Quote__c.NEFF_Subtotal__c == null), true, false)}">
<br/>
<table width="100%">
             <td colspan="1" style="font-size:14px;font-weight:bold;text-align:right">NEFF Subtotal &nbsp;&nbsp;    
                <apex:outputText value="{0, number,   £,##  0.00}" > <apex:param value="{!Quote__c.NEFF_Subtotal__c}"/> </apex:outputText> </td>
             </table>
 <br /><br />
</apex:outPutPanel>

You main issue though is due to the <tr> being rendered and the <td> having no content due to the rendered attributes on the outputtext so...

you should also wrap you in the main table in an output panel and move the rendered attributes there

The reason again is because you are still rendering the Tr and the TD's even if the TD's have no content due to the current place of the rendered attributes

<apex:outPutPanel layout="none" rendered="{!If(quoD.Family_2__c == 'NEFF', true, false)}">
<tr style="font-size:12px;text-align:left">     
            <td align="left" style="font-size:12px;text-align:left">
                 <apex:outputText  value="{!quoD.Product__r.Name}" />
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{!quoD.Product__r.description}" />
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{0, number, 0}" >
                <apex:param value="{!quoD.Quantity__c}"/> 
                </apex:outputText>
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{!quoD.Product__r.Colour__c}" />
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{0, number,£,##  0.00}" > <apex:param value="{!quoD.Unit_Price__c}"/> </apex:outputText>
            </td>
            <td align="left" style="font-size:12px;text-align:left">
                <apex:outputText value="{0, number,£,##  0.00}" > <apex:param value="{!quoD.Amount__c}"/>  </apex:outputText>
            </td>
         </tr>
</apex:outPutPanel>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .