[SalesForce] When render VF page as pdf, no white space between label and value

I have a page that I am rendering as a pdf. The label and the value are right on top of each other. How do I get spaces between them? The critical line is:

<apex:outputField label="{!f.pdfLabel}" value="{!evalForm[f.fieldMember]}" style="white-space:pre" />

I have tried it with and without label=. I have added spaces to the f.label value in the controller to no avail.
Does anyone know how to display some whitespace between the label and value? I cannot use outputtext because some fields are ids, and I need the name not the id displayed.

Thanks.

Best Answer

I would try several possible solutions:

Just divide output field into the label/value:

<apex:pageBlockSectionItem>
    <apex:outputLabel value="{!testacc.Name}" style="margin-right:5px;" />
    <apex:outputField value=" {!testacc.Name}"/>
</apex:pageBlockSectionItem>

Or use outputText:

<apex:outputText label="{!f.pdfLabel}" 
                  value="{!' '+evalForm[f.fieldMember]}" 
                  style="white-space:pre" />

Or

<apex:outputText label="{!f.pdfLabel}" 
                  value=" {!evalForm[f.fieldMember]}" 
                  style="white-space:pre" />
Related Topic