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
textualtextual 

VF to PDF - using HTML from a SOQL Call

were storing some html template pieces in a table and i want to use these snippets on a vf pdf rendered page

but whats ending up happening is the raw html is displayed on the pdf, not the rendered html

any way to get around this?

Best Answer chosen by Admin (Salesforce Developers) 
Cloud CredenceCloud Credence

Hi,

 

Try this.

 

<apex:page>
Hello!
<apex:outputText escape="false" value="{!$User.FirstName}"/>
</apex:page>

 

If User record's first name has got value "<b>Cloud Credence</b>" , then the vf page shall have "Cloud Credene" as bold.

 

Best Wishes,

All Answers

Cloud CredenceCloud Credence

Hi,

 

Try this.

 

<apex:page>
Hello!
<apex:outputText escape="false" value="{!$User.FirstName}"/>
</apex:page>

 

If User record's first name has got value "<b>Cloud Credence</b>" , then the vf page shall have "Cloud Credene" as bold.

 

Best Wishes,

This was selected as the best answer
textualtextual

Thanks, the PDF is rendering the HTML correctly. One additional thing is how to dynamically replace any {!obj.var} occurances with the actual values. I can do a replace on the string to look for known vars, but if i want to add a var to the HTML, id have to alter the code to explicitly look for a var and replace it. Any ideas on how to replace these dynamically??

textualtextual

i was considering using fieldsets to drive the dynamic piece

define a fieldset, store the fields in local list, build soql, then do the replace

but the replace part im not sure of

 

how can i say to look for a {!obj.var} and replace with obj.[value of var from list]