この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

Visualforce PDF 表示の使用時に使用可能なフォント

Visualforce PDF 表示でサポートされるフォントのセットは限られています。PDF 出力を期待どおりに表示するには、次のフォント名を使用してください。
ページを PDF として表示する場合、次のフォントを使用できます。各書体で最初に記載されている font-family 値が推��値です。
書体 使用する font-family スタイル値 (フォントシノニム)
Arial Unicode MS
  • Arial Unicode MS
Helvetica
  • sans-serif
  • SansSerif
  • Dialog
Times
  • serif
  • Times
Courier
  • Monospace
  • Courier
  • Monospaced
  • DialogInput
  • これらのルールは、サーバ側での PDF 表示に適用されます。ページを Web ブラウザで表示すると、異なる結果になる場合があります。
  • 上記以外の値のスタイルを使用したテキストは、デフォルトのフォントスタイルである Times になります。つまり、Helvetica の書体で表示するには Helvetica のシノニムを使用しますが、font-family スタイルに「Helvetica」を使用すると Times として表示されてしまいます。「sans-serif」を使用することをお勧めします。
  • Arial Unicode MS は、使用可能な唯一のマルチバイトフォントで、Latin 文字セットを使用しない言語の拡張文字セットをサポートします。

メモ

PDF 表示のフォントテストページ

次のページを使用して、Visualforce PDF 表示エンジンでフォント表示をテストできます。
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>
上述のページでは、単純な「PDF に保存」機能を提供する次のコントローラを使用します。
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}