Loading TTF font files from the classpath
-----------------------------------------

                 Key: PDFBOX-732
                 URL: https://issues.apache.org/jira/browse/PDFBOX-732
             Project: PDFBox
          Issue Type: Improvement
          Components: PDModel
    Affects Versions: 1.1.0
            Reporter: Neil McErlean


Currently (pdfbox 1.1.0 & 1.2.0 snapshot) TTF font files can only be loaded 
from the file system as PDTrueTypeFont exposes two load methods:
    public static PDTrueTypeFont loadTTF(PDDocument, String)
    public static PDTrueTypeFont loadTTF(PDDocument, File)
The first wraps the String in a java.io.File object and delegates to the 
second, so all TTF reading is from the file system.

It would be useful to be able to read TTF files from the classpath - or indeed 
from any arbitrary stream.
Could we have a third method?:
    public static PDTrueTypeFont loadTTF(PDDocument, InputStream)

This would allow TTFs to be loaded like so:
PDTrueTypeFont.load(myDoc, 
MyClass.class.getClassLoader().getResourceAsStream("myFont.ttf"));


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to