Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Do you need to process or display PDF files?

Find out why you should be using IDRSolutions software

Problems caused by Arial font in PDF files

1 min read

Arial is a very popular font for use in PDF files. It is also one of the font families assumed to be present for PDF viewing. However we have found it can be rather problematic. The reason for this is that there is more than ONE version of Arial floating around. Recounting a recent issue I looked into for our PDF viewer will show this issue more clearly.

We had a PDF file which contained columns of text on a page. On our viewer, they were not aligned correctly. Digging into the file it turned out that the alignment was being achieved using spaces in Arial. There were no widths defined for the space character, so we used the Arial space width defined in the AFM files. But Acrobat was using the space width from the Arial truetype font (and these values are not identical). So we could fix it by adding Arial.tff to our setup.

The problem is that we are quite often dealing with at least 3 different types of Arial – there is the Arial defined in the AFM files and then there is Arial as a local or embedded font (I have seen it in both non-CID TrueType, a CID version and Type1 versions). Because we are working in Java we also have access to a font from Java called ‘Arial‘ which actually contains some broken glyphs. And all of these fonts are available in slightly different versions. This can cause issues when trying to show some documents.

So it is worth including the width information of all fonts in your PDF files. A good policy is to embed your fonts as a matter of course and then you do not end up with documents which rely on local fonts on your machine to appear correctly.



Our software libraries allow you to

Convert PDF files to HTML
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Read and write HEIC and other Image formats in Java
Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Should you travel by plane or train?

Why travel to Switzerland by train This year, my daughter set me the challenge to take the train rather than fly when I next...
Mark Stephens
1 min read