No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
Fonts Available When Using Visualforce PDF Rendering
Visualforce PDF rendering supports a
limited set of fonts. Use the following font names to ensure that PDF output
renders as you expect.
The fonts available when you’re rendering a page as a PDF are as follows. The
first listed font-family value for each
typeface is the recommended choice.
| Typeface | Style font-family Value to Use (Font Synonyms) |
|---|---|
| Arial Unicode MS |
|
| Helvetica |
|
| Times |
|
| Courier |
|
Font Test Page for PDF Rendering
You can use the following page to test font rendering with the Visualforce PDF rendering
engine.
1<apex:page showHeader="false" standardStylesheets="false"
2 controller="SaveToPDF" renderAs="{! renderAs }">
3
4<apex:form rendered="{! showPrintLink }" style="text-align: right; margin: 10px;">
5 <div><apex:commandLink action="{! print }" value="Save to PDF"/></div>
6 <hr/>
7</apex:form>
8
9<h1>PDF Fonts Test Page</h1>
10
11<p>This text, which has no styles applied, is styled in the default font for the
12 Visualforce PDF rendering engine.</p>
13
14<p>The fonts available when rendering a page as a PDF are as follows. The first
15listed <code>font-family</code> value for each typeface is the recommended choice.</p>
16
17<table border="1" cellpadding="6">
18<tr><th>Font Name</th><th>Style <code>font-family</code> Value to Use (Synonyms)</th></tr>
19<tr><td><span style="font-family: Arial Unicode MS; font-size: 14pt; ">Arial
20 Unicode MS</span></td><td><ul>
21 <li><span style="font-family: Arial Unicode MS; font-size: 14pt;">Arial Unicode MS</span></li>
22 </ul></td></tr>
23<tr><td><span style="font-family: Helvetica; font-size: 14pt;">Helvetica</span></td>
24 <td><ul>
25 <li><span style="font-family: sans-serif; font-size: 14pt;">sans-serif</span></li>
26 <li><span style="font-family: SansSerif; font-size: 14pt;">SansSerif</span></li>
27 <li><span style="font-family: Dialog; font-size: 14pt;">Dialog</span></li>
28 </ul></td></tr>
29<tr><td><span style="font-family: Times; font-size: 14pt;">Times</span></td><td><ul>
30 <li><span style="font-family: serif; font-size: 14pt;">serif</span></li>
31 <li><span style="font-family: Times; font-size: 14pt;">Times</span></li>
32</ul></td></tr>
33<tr><td><span style="font-family: Courier; font-size: 14pt;">Courier</span></td>
34 <td><ul>
35 <li><span style="font-family: monospace; font-size: 14pt;">monospace</span></li>
36 <li><span style="font-family: Courier; font-size: 14pt;">Courier</span></li>
37 <li><span style="font-family: Monospaced; font-size: 14pt;">Monospaced</span></li>
38 <li><span style="font-family: DialogInput; font-size: 14pt;">DialogInput</span></li>
39</ul></td></tr>
40</table>
41
42<p><strong>Notes:</strong>
43<ul>
44<li>These rules apply to server-side PDF rendering. You might see different results
45 when viewing this page in a web browser.</li>
46<li>Text styled with any value besides those listed above receives the default font
47 style, Times. This means that, ironically, while Helvetica's synonyms render as
48 Helvetica, using "Helvetica" for the font-family style renders as Times.
49 We recommend using "sans-serif".</li>
50<li>Arial Unicode MS is the only multibyte font available, providing support for the
51 extended character sets of languages that don't use the Latin character set.</li>
52</ul>
53</p>
54
55</apex:page>The preceding page uses the following controller, which provides a simple “Save to PDF”
function.
1public with sharing class SaveToPDF {
2
3 // Determines whether page is rendered as a PDF or just displayed as HTML
4 public String renderAs { get; set; }
5
6 // Determines whether to show the "Save As PDF" interface
7 public Boolean getShowPrintLink() {
8 return ( (renderAs == null) || ( ! renderAs.startsWith('PDF')) );
9 }
10
11 // Action method to "print" to PDF
12 public PageReference print() {
13 renderAs = 'PDF';
14 return null;
15 }
16
17}