1

I am building a Visualforce page as PDF and i want to show some sections and clauses of a Contract, which are within Salesforce as records. The value i want to display is rich text area and this rich text area has some words in bold. However, this styling is not applied. Has anyone faced this issue in the past or has an idea on how to handle this? Code below. Field that is not displayed with the appropriate styling: csclm__Final_Rich_Text__c

<div class="section">
                    <apex:repeat value="{!sections}" var="section">
                        <div class="section section{!section.csclm__Level__c}">
                            <p
                               class="subsection{!section.csclm__Level__c}" style="font-family: Arial Unicode MS;">
                                {!section.csclm__Numbering__c}
                                {!section.csclm__Section_Name__c}</p>
                            <apex:repeat value="{!section.csclm__Transactional_Clauses__r}"
                                         var="clause">
                                <div class="clause clause{!clause.csclm__Level__c}" style="font-family: Arial Unicode MS;">
                                    <span class="numbering">{!clause.csclm__Numbering__c}</span>
                                    <apex:outputText value = "{!clause.csclm__Final_Rich_Text__c}" escape="false" richtext="true"></apex:outputText>
                                </div>
                            </apex:repeat>
                        </div>
                    </apex:repeat>
                </div>

Example of record in Salesforce (Rich Text Area), word test is in bold!: enter image description here

Example of how it is rendered in PDF through VF page. As you can see, there is no difference between the text "TEST", which should be in bold and the rest of the sentence.

enter image description here

4
  • 1
    Can you try apex:outputField Dec 24 '20 at 10:42
  • Thanks for your response Nagendra. By using apex:outputField i see that bold letters do work. However, i have problem with showing special characters (e.g. Greek letters). Do you have a suggestion on this? Dec 24 '20 at 11:04
  • Can you share an example? I just used it and was able to show that β Dec 24 '20 at 11:04
  • Try this please: "O Προμηθευτής, είναι κάτοχος νόμιμης Άδειας Προμήθειας και Άδειας Παραγωγής Ηλεκτρισμού, και αναλαμβάνει να προμηθεύει ηλεκτρική ενέργεια στο σημείο σύνδεσης του Πελάτη" Dec 24 '20 at 11:10
2

I was going through the documentation and I believe this is a limitation from salesforce end.

Documentation

The PDF rendering service renders the markup and data on your page, but it might not render formatting contained within the contents of rich text area fields added to the page.

But try adding this:

<head>
    <style>
        body { font-family: 'Arial Unicode MS'; }
    </style>
</head>

and it displays greek letters too.


<apex:page showHeader="false" applyBodyTag="false" renderAs="pdf" controller="test54">
    <head>
        <style>
            body { font-family: 'Arial Unicode MS'; }
        </style>
    </head>
    <body>
    <apex:pageBlock>
        <apex:pageBlockSection title="Opportunity Information">
            <apex:outputField value="{!listOpportunity.name}"/>
            <apex:outputField value="{!listOpportunity.TestRichText__c}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
    </body>
</apex:page>

enter image description here

1
  • Nagendra, thank you very much for your detailed response. However, i still cannot achieve bold letters (formatting) and greek letters. :( If you find something, let me know:) However, i would like to thank you for your time and wish you merry Christmas!!! Dec 24 '20 at 16:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.