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
jasonwanBellajasonwanBella 

Visualforce renderAs PDF - outputfield changes my whole page of font

Code:
<style type="text/css">
@page {  margin-top: 0%;}
table{ font-family: "TTE19DCA30t00"; font-size:7pt; }
.regText { font-size:7pt;}
.boldText { font-size:7pt; font-weight:bold; }
.titleText { font-size:12pt; font-weight:bold;}
body { font-family: "TTE19DCA30t00"; font-size:7pt; }
.space{ font-size:2pt; }
</style>

<table>
<tr>
<td class="regText" width="15%">{!productA.Quantity}</td>
<td class="regText"><apex:outputField value="{!productA.UnitPrice}" /></td>
</tr> 
</table>

 the <apex:outputField > NOT ONLY doesnt take the regText style but it even changes the entire page to Arial font-size:9 for some reason.   Ex: The productA.Quantity turns loses its custom style as well.  

Once I take out outputField, every text on the form goes back to the custom way that I would want.

I was hoping to leverage the currency style form included in outputField to get the right formatting for Product Unit Price.
If there is another way to get the formatting for a currency field such as Unit Price, please let me know then I can avoid this outputField bug.

Thanks.


jasonwanBellajasonwanBella
Also - this is only when renderAs="pdf" in Visualforce.  Without PDF, the custom font actually works and looks the way I want using outputField.
Rajesh ShahRajesh Shah
Hi,
 
I am trying to generate Arial font in my visualforce pdf but for some reason it is not getting generated. You said in your post that you were getting the pdf in Arial font. Let me know what font style you are using. Pasted below is the style sheet I am using.
 

.BoldColumnlabel{

border-left: windowtext 0.5pt solid;

-font-size:9.1px;

background-color: #dbe5f1;

font-family: Arial;

font-weight: bold;

width: 20%;

charoff: 3;

}

Also instead of Arial. Arial Unicode MS worked. However where I needed to display the font in bold, it did not worked.

Thank you,

 

DamoMarkDamoMark
Has anybody solved this?

It seems to me that when you use the outputField tag Salesforces creates some Javascript on the page. This seems to mess up the styling when you render the page in PDF format, but works fine in HTML format.

I need to use outputField as I have currencies on my page and I need to render them with decimal places in PDF format. Is there another way to output fields and format the way currencies they are rendered?
DamoMarkDamoMark
Found the solution to this.

You need upload a style sheet as a static resource and add it then to the visualforce pages and not include the styles on the actual visualforce page.

I.E upload a static resource called "CSS_Style" to your org then add this tag to your VF page
NielsSchepersNielsSchepers

To get Arial and bold font weight, I used this code

 

<style type="text/css">
   body {font-family: "Arial" "Sans-Serif"; font-size:12px; } 
</style>

 Hope this will work for you too