pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1770259 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java
Date Thu, 17 Nov 2016 19:14:04 GMT
Author: tilman
Date: Thu Nov 17 19:14:03 2016
New Revision: 1770259

URL: http://svn.apache.org/viewvc?rev=1770259&view=rev
Log:
PDFBOX-3577: allow alternate github BaselineTIFFTagSet class

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java?rev=1770259&r1=1770258&r2=1770259&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java Thu Nov
17 19:14:03 2016
@@ -35,6 +35,22 @@ class TIFFUtil
 {
     private static final Log LOG = LogFactory.getLog(TIFFUtil.class);
 
+    private static String tagSetClassName = "com.sun.media.imageio.plugins.tiff.BaselineTIFFTagSet";
+    
+    static
+    {
+        try
+        {
+            String alternateClassName = "com.github.jaiimageio.plugins.tiff.BaselineTIFFTagSet";
+            Class.forName(alternateClassName);
+            tagSetClassName = alternateClassName;
+        }
+        catch (ClassNotFoundException ex)
+        {
+            // ignore
+        }
+    }
+
     /**
      * Sets the ImageIO parameter compression type based on the given image.
      * @param image buffered image used to decide compression type
@@ -81,8 +97,7 @@ class TIFFUtil
         if (root.getElementsByTagName("TIFFIFD").getLength() == 0)
         {
             ifd = new IIOMetadataNode("TIFFIFD");
-            ifd.setAttribute("tagSets",
-                             "com.sun.media.imageio.plugins.tiff.BaselineTIFFTagSet");
+            ifd.setAttribute("tagSets", tagSetClassName);
             root.appendChild(ifd);
         }
         else



Mime
View raw message