pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1576828 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java
Date Wed, 12 Mar 2014 17:26:37 GMT
Author: tilman
Date: Wed Mar 12 17:26:36 2014
New Revision: 1576828

URL: http://svn.apache.org/r1576828
Log:
PDFBOX-1977: set PhotometricInterpretation to WhiteIsZero for b/w images because of XP preview
bug

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java?rev=1576828&r1=1576827&r2=1576828&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/TIFFUtil.java Wed Mar 12 17:26:36
2014
@@ -103,6 +103,14 @@ class TIFFUtil
         ifd.appendChild(createLongField(278, "RowsPerStrip", image.getHeight()));
         ifd.appendChild(createAsciiField(305, "Software", "PDFBOX"));
 
+        if (image.getType() == BufferedImage.TYPE_BYTE_BINARY && 
+                image.getColorModel().getPixelSize() == 1)
+        {
+            // set PhotometricInterpretation WhiteIsZero
+            // because of bug in Windows XP preview
+            ifd.appendChild(createShortField(262, "PhotometricInterpretation", 0));
+        }
+        
         try
         {
             metadata.mergeTree(SUN_TIFF_FORMAT, root);



Mime
View raw message