| <!-- |
| ! Licensed to the Apache Software Foundation (ASF) under one or more |
| ! contributor license agreements. See the NOTICE file distributed with |
| ! this work for additional information regarding copyright ownership. |
| ! The ASF licenses this file to You under the Apache License, Version 2.0 |
| ! (the "License"); you may not use this file except in compliance with |
| ! the License. You may obtain a copy of the License at |
| ! |
| ! http://www.apache.org/licenses/LICENSE-2.0 |
| ! |
| ! Unless required by applicable law or agreed to in writing, software |
| ! distributed under the License is distributed on an "AS IS" BASIS, |
| ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| ! See the License for the specific language governing permissions and |
| ! limitations under the License. |
| !--> |
| <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd"> |
| <document> |
| <header> |
| <title>PDFBox - PDF Fonts</title> |
| </header> |
| <body> |
| <section> |
| <title>Standard 14 Fonts</title> |
| <p> |
| The PDF specification states that a standard set of 14 fonts will always be available when consuming |
| PDF documents. In PDFBox these are defined as constants in the PDType1Font class. |
| </p> |
| <table> |
| <tr><th>Standard Font</th></tr> |
| <tr><td>PDType1Font.TIMES_ROMAN</td></tr> |
| <tr><td>PDType1Font.TIMES_BOLD</td></tr> |
| <tr><td>PDType1Font.TIMES_ITALIC</td></tr> |
| <tr><td>PDType1Font.TIMES_BOLD_ITALIC</td></tr> |
| <tr><td>PDType1Font.HELVETICA</td></tr> |
| <tr><td>PDType1Font.HELVETICA_BOLD</td></tr> |
| <tr><td>PDType1Font.HELVETICA_OBLIQUE</td></tr> |
| <tr><td>PDType1Font.HELVETICA_BOLD_OBLIQUE</td></tr> |
| <tr><td>PDType1Font.COURIER</td></tr> |
| <tr><td>PDType1Font.COURIER_BOLD</td></tr> |
| <tr><td>PDType1Font.COURIER_OBLIQUE</td></tr> |
| <tr><td>PDType1Font.COURIER_BOLD_OBLIQUE</td></tr> |
| <tr><td>PDType1Font.SYMBOL</td></tr> |
| <tr><td>PDType1Font.ZAPF_DINGBATS</td></tr> |
| </table> |
| </section> |
| <section> |
| <title>TrueType Fonts</title> |
| <section> |
| <title>Embedding TrueType Fonts</title> |
| <p> |
| PDFBox supports embedding TrueType fonts. Loading a new font is easy. |
| </p> |
| <source> |
| PDDocument doc = PDDocument.load( ... ); |
| PDFont font = PDTrueTypeFont.loadTTF( doc, new File( "SpecialFont.ttf" ) );</source> |
| |
| </section> |
| <section> |
| <title>External TrueType Fonts</title> |
| <p> |
| While it is recommended to embed all fonts for greatest portability not all PDF producer applications |
| will do this. When displaying a PDF it is necessary to find an external font to use. |
| PDFBox will look for a mapping file to use when substituting fonts.<br /> |
| <br/> |
| PDFBox will load <i>Resources/PDFBox_External_Fonts.properties</i> off of the classpath to map |
| font names to TTF font files. The <i>UNKNOWN_FONT</i> property in that file will tell PDFBox which font |
| to use when no mapping exists. |
| </p> |
| </section> |
| </section> |
| </body> |
| </document> |