You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Samuel Penn <sa...@glendale.org.uk> on 2010/02/08 13:26:45 UTC

Problems with font rendering

Hi all,

I'm using PDFBox 0.8 (Java) to render some PDFs as images, and I'm
running into problems with font rendering. For some documents (notably, 
some test documents I've created using OpenOffice) all text is showing
up as squares.

Looking at one of the documents in Adobe Acrobat, the fonts that are
being used are:

Arial-BoldMT (Embedded Subset)
    Type: TrueType
    Encoding: Built-in

TimesNewRomanPS-BoldMT (Embedded Subset)
    Type: TrueType
    Encoding: Built-in

TimesNewRomanPSMT (Embedded Subset)
    Type: TrueType
    Encoding: Built-in

Verdana-Bold (Embedded Subset)
    Type: TrueType
    Encoding: Built-in

I would have thought that Times Roman at least would have matched 
against the default fonts.

Regardless of that, I've set up a PDFBox_External_font.properties to map
any unknown fonts to Arial, so I'd expect to see Arial being used rather
than just getting squares. My properties file is:

UNKNOWN_FONT=Resources/ttf/arial.ttf

I've created it as Resources/PDFBox_External_Font.properties and it is
on the class path (the same class path as the rest of my classes). I've
copied arial.ttf into the referenced location.

My first question is, should the above fonts display normally? Secondly,
if they can't be used, why isn't my default arial font being used?

Thanks.

-- 
Be seeing you,                         http://www.glendale.org.uk
Sam.                        Mail/IM (Jabber): sam@glendale.org.uk 

Re: Problems with font rendering

Posted by Samuel Penn <sa...@glendale.org.uk>.
On Monday 08 February 2010 12:26:45 Samuel Penn wrote:
> I'm using PDFBox 0.8 (Java) to render some PDFs as images, and I'm
> running into problems with font rendering. For some documents
>  (notably, some test documents I've created using OpenOffice) all
>  text is showing up as squares.
> 
> Looking at one of the documents in Adobe Acrobat, the fonts that are
> being used are:
> 
> Arial-BoldMT (Embedded Subset)
> TimesNewRomanPS-BoldMT (Embedded Subset)
> TimesNewRomanPSMT (Embedded Subset)
> Verdana-Bold (Embedded Subset)

This bug looks similar:

http://issues.apache.org/jira/browse/PDFBOX-501

So I guess it's a bug rather than me doing something stupid.

Is there a workaround, such as forcing PDFBox to use a different
font rather than trying to use the embedded subset?

-- 
Be seeing you,                         http://www.glendale.org.uk
Sam.                        Mail/IM (Jabber): sam@glendale.org.uk