pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1769334 - /pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java
Date Fri, 11 Nov 2016 19:47:37 GMT
Author: tilman
Date: Fri Nov 11 19:47:37 2016
New Revision: 1769334

URL: http://svn.apache.org/viewvc?rev=1769334&view=rev
Log:
PDFBOX-3563: process softmasks in ExtractImages

Modified:
    pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java

Modified: pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java?rev=1769334&r1=1769333&r2=1769334&view=diff
==============================================================================
--- pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java (original)
+++ pdfbox/branches/2.0/tools/src/main/java/org/apache/pdfbox/tools/ExtractImages.java Fri
Nov 11 19:47:37 2016
@@ -39,6 +39,9 @@ import org.apache.pdfbox.pdmodel.graphic
 import org.apache.pdfbox.pdmodel.graphics.color.PDDeviceRGB;
 import org.apache.pdfbox.tools.imageio.ImageIOUtil;
 import org.apache.pdfbox.contentstream.PDFGraphicsStreamEngine;
+import org.apache.pdfbox.pdmodel.PDResources;
+import org.apache.pdfbox.pdmodel.graphics.form.PDTransparencyGroup;
+import org.apache.pdfbox.pdmodel.graphics.state.PDSoftMask;
 
 /**
  * Extracts the images from a PDF file.
@@ -192,7 +195,21 @@ public final class ExtractImages
 
         public void run() throws IOException
         {
-            processPage(getPage());
+            PDPage page = getPage();
+            processPage(page);
+            PDResources res = page.getResources();
+            for (COSName name : res.getExtGStateNames())
+            {
+                PDSoftMask softMask = res.getExtGState(name).getSoftMask();
+                if (softMask != null)
+                {
+                    PDTransparencyGroup group = softMask.getGroup();
+                    if (group != null)
+                    {
+                        processSoftMask(group);
+                    }
+                }
+            }
         }
 
         @Override



Mime
View raw message