pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1484277 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/Invoke.java
Date Sun, 19 May 2013 12:01:01 GMT
Author: lehmi
Date: Sun May 19 12:01:01 2013
New Revision: 1484277

URL: http://svn.apache.org/r1484277
Log:
PDFBOX-1602: take the optional matrix of an XObjectForm into account

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/Invoke.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/Invoke.java?rev=1484277&r1=1484276&r2=1484277&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/Invoke.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/operator/Invoke.java Sun May
19 12:01:01 2013
@@ -22,6 +22,7 @@ import org.apache.pdfbox.cos.COSStream;
 import org.apache.pdfbox.pdmodel.PDResources;
 import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject;
 import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectForm;
+import org.apache.pdfbox.util.Matrix;
 import org.apache.pdfbox.util.PDFMarkedContentExtractor;
 import org.apache.pdfbox.util.PDFOperator;
 
@@ -53,18 +54,25 @@ public class Invoke extends OperatorProc
 
         Map<String,PDXObject> xobjects = context.getXObjects();
         PDXObject xobject = (PDXObject) xobjects.get(name.getName());
-        if (this.context instanceof PDFMarkedContentExtractor)
+        if (context instanceof PDFMarkedContentExtractor)
         {
-            ((PDFMarkedContentExtractor) this.context).xobject(xobject);
+            ((PDFMarkedContentExtractor) context).xobject(xobject);
         }
 
         if(xobject instanceof PDXObjectForm)
         {
             PDXObjectForm form = (PDXObjectForm)xobject;
             COSStream formContentstream = form.getCOSStream();
+            // if there is an optional form matrix, we have to map the form space to the
user space
+            Matrix matrix = form.getMatrix();
+            if (matrix != null) 
+            {
+                Matrix xobjectCTM = matrix.multiply( context.getGraphicsState().getCurrentTransformationMatrix());
+                context.getGraphicsState().setCurrentTransformationMatrix(xobjectCTM);
+            }
             // find some optional resources, instead of using the current resources
             PDResources pdResources = form.getResources();
-            getContext().processSubStream( context.getCurrentPage(), pdResources, formContentstream
);
+            context.processSubStream( context.getCurrentPage(), pdResources, formContentstream
);
         }
     }
 }



Mime
View raw message