diff --git a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java index d5804563a95..67ba4cd40b7 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDCIDFont.java @@ -338,7 +338,10 @@ public float getAverageFontWidth() } } } - averageWidth = totalWidths / characterCount; + if (characterCount != 0) + { + averageWidth = totalWidths / characterCount; + } if (averageWidth <= 0 || Float.isNaN(averageWidth)) { averageWidth = getDefaultWidth();