pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hesham G." <heshamgne...@gmail.com>
Subject Using a system font file with loadTTF method
Date Tue, 22 May 2012 13:45:37 GMT
Hello ,

This is a more Java question rather than a PDFBox question : ) , but I can't find an answer
to it.

I am trying to use a system font file in drawing text to a PDF file using PDFBox, through
the method :
PDTrueTypeFont.loadTTF( PDDocuent pdfFile, File fontFile );

The problem here is that the loadTTF(...) method accepts a (File) object, while I can only
get the System font as a (Font) object using this code :
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fonts = e.getAllFonts();

Where I get one of the (fonts) objects to use it. Is there a way to convert the Font object
to File object ?
I am using Mac OS X.


Best regards ,
Hesham 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message