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

preserve line breaks in PDF

I have a text area in custom object. The text area had html <br/> tags for line breaks and etc. When I output the text area in VF page,

which is rendered as PDF, the formatting goes away. If I dont render it as PDF, the formatting stays. How can I preserve line breaks

in PDF rendering in VF page? Please help!!


For inserting the PDF break there is separate tag.


For more details you can check out this link.


You may require replacing the <br/> tag with the <div> for page break with a specific CSS style.


IF you do not want html tags in pdf after doing renderAs pdf then you can set escape="false" property with <apex:outputtext escape="false">                                  

Yachana YachanaYachana Yachana
You can simple use HTML Tag <pre>. This will ensure line breaks are respected.