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
Abhijeet Purohit01Abhijeet Purohit01 

How to change font-family to arial when the vf page is rendered as PDF?

I have rendered a vf page as pdf. I am unable to change the fon-family to arial.

 

I have used

<style type=text/css>

p

{

font-family:"Arial Unicode MS";

font-size:14pt;

}

span

{

font-family:"Arial Unicode MS";

font-size:8pt;

}

h1

{

font-family:"Arial Unicode MS";

font-size:9pt;

}

</style>

<p>some text1</p>

<span>some text2</span>

<h1>some text3</h1>

--- - --  - - -- -  -

- - - - - - - --

But the problem here is am getting a new line everytime I use <p> and <h1> tag.

I dno't want this new line to occur.

Also I tried using <h2>,<h3>,.. , <pre>, <b> and

display:inline;

 

 

How to get the font family as arial without a new line. Also how to make the text bold?

I have tried <b> tag and

font-family:"Arial Unicode MS Bold";

 

Its not working.

 

 

Pls help.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
@taani.ax1426@taani.ax1426

Hi,

 

Try this code:

 

<apex:page renderAs="pdf" standardController="Account">
<body>

<span style="font-family: Arial Unicode MS;font-size: 14px; font-weight: bold; vertical-align: text-bottom;">Text1</span>
<span style="font-family: Arial Unicode MS;font-size: 9px; vertical-align: text-bottom;">Text2</span>
<span style="font-family: Arial Unicode MS;font-size: 8px;font-weight: bold; vertical-align: text-bottom;">Text3</span>

</body>
</apex:page>

 

Regards,

Taani

All Answers

Kapil GoutamKapil Goutam

I don't think you can apply any style with reder as pdf.

@taani.ax1426@taani.ax1426

Hi,

 

Try this code:

 

<apex:page renderAs="pdf" standardController="Account">
<body>

<span style="font-family: Arial Unicode MS;font-size: 14px; font-weight: bold; vertical-align: text-bottom;">Text1</span>
<span style="font-family: Arial Unicode MS;font-size: 9px; vertical-align: text-bottom;">Text2</span>
<span style="font-family: Arial Unicode MS;font-size: 8px;font-weight: bold; vertical-align: text-bottom;">Text3</span>

</body>
</apex:page>

 

Regards,

Taani

This was selected as the best answer
Wagner Baldin 9Wagner Baldin 9
It works! Thanks a lot. I could change font family to Arial in my PDF rendered document!