pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1791272 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
Date Thu, 13 Apr 2017 16:15:19 GMT
Author: tilman
Date: Thu Apr 13 16:15:18 2017
New Revision: 1791272

URL: http://svn.apache.org/viewvc?rev=1791272&view=rev
Log:
PDFBOX-3750: be lenient when ToUnicode cmap is bad

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java?rev=1791272&r1=1791271&r2=1791272&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java Thu Apr 13
16:15:18 2017
@@ -131,11 +131,20 @@ public abstract class PDFont implements
         COSBase toUnicode = dict.getDictionaryObject(COSName.TO_UNICODE);
         if (toUnicode != null)
         {
-            toUnicodeCMap = readCMap(toUnicode);
-            if (toUnicodeCMap != null && !toUnicodeCMap.hasUnicodeMappings())
+            CMap cmap = null;
+            try
             {
-                LOG.warn("Invalid ToUnicode CMap in font " + getName());
+                cmap = readCMap(toUnicode);
+                if (cmap != null && !cmap.hasUnicodeMappings())
+                {
+                    LOG.warn("Invalid ToUnicode CMap in font " + getName());
+                }
             }
+            catch (IOException ex)
+            {
+                LOG.error("Could not read ToUnicode CMap in font " + getName(), ex);
+            }
+            toUnicodeCMap = cmap;
         }
         else
         {



Mime
View raw message