pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1611894 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontFactory.java
Date Sat, 19 Jul 2014 11:38:20 GMT
Author: tilman
Date: Sat Jul 19 11:38:19 2014
New Revision: 1611894

URL: http://svn.apache.org/r1611894
Log:
PDFBOX-2222: create a default font if font doesn't exist

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontFactory.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontFactory.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontFactory.java?rev=1611894&r1=1611893&r2=1611894&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontFactory.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontFactory.java Sat
Jul 19 11:38:19 2014
@@ -118,4 +118,19 @@ public class PDFontFactory
             throw new IOException("Invalid font type: " + type);
         }
     }
+
+    /**
+     * Create a default font
+     * 
+     * @return a default font
+     * @throws IOException if something goes wrong
+     */
+    public static PDFont createDefaultFont() throws IOException
+    {
+        COSDictionary dict = new COSDictionary();
+        dict.setItem(COSName.TYPE, COSName.FONT);
+        dict.setItem (COSName.SUBTYPE, COSName.TRUE_TYPE);
+        dict.setString(COSName.BASE_FONT, "Arial");
+        return createFont(dict);
+    }
 }



Mime
View raw message