pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Chow <eric...@gmail.com>
Subject Use external TrueType font in PDFBox-1.3.1?
Date Thu, 25 Nov 2010 02:00:40 GMT

In my PDF, I am using some windows TrueType Font.
For example, a true type font file "kaiu.ttf", how can I load this font file
for converting the pdf pages to image?

Would you please to teach me? Or would you please to show me a simple

Furthermore, how can I change the original v1.3.1 source codes for this?

In the version 1.1, I add some codes in the
org.apache.pdfbox.pdmodel.font.PDType1Font.java as following:

public void drawString( String string, Graphics g, float fontSize,
            AffineTransform at, float x, float y ) throws IOException


          // line 241
           try {
                  // loads the external TrueType Font
                  Font customerFont = FontLoader.loadFont(baseFont);

                  if (customerFont != null) {
                     awtFont = customerFont;
                } catch(Exception ex) {


                if (awtFont == null) {
                  // we can't find anything, so we have to use the standard
                    awtFont = FontManager.getStandardFont();

                log.info("Using font "+awtFont.getName()+ " instead");


But in the v1.3.1, I added these codes in the PDType1Font.java, it doesn't
work any more.
Would you please to teach me?

Best regards,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message