pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1857952 - in /pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util: PrintImageLocations.java RemoveAllText.java
Date Mon, 22 Apr 2019 11:29:23 GMT
Author: lehmi
Date: Mon Apr 22 11:29:23 2019
New Revision: 1857952

URL: http://svn.apache.org/viewvc?rev=1857952&view=rev
Log:
PDFBOX-4458: use new operator name constants

Modified:
    pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/PrintImageLocations.java
    pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java

Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/PrintImageLocations.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/PrintImageLocations.java?rev=1857952&r1=1857951&r2=1857952&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/PrintImageLocations.java
(original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/PrintImageLocations.java
Mon Apr 22 11:29:23 2019
@@ -26,6 +26,7 @@ import org.apache.pdfbox.pdmodel.graphic
 import org.apache.pdfbox.util.Matrix;
 import org.apache.pdfbox.contentstream.operator.DrawObject;
 import org.apache.pdfbox.contentstream.operator.Operator;
+import org.apache.pdfbox.contentstream.operator.OperatorName;
 import org.apache.pdfbox.contentstream.PDFStreamEngine;
 
 import java.io.File;
@@ -110,7 +111,7 @@ public class PrintImageLocations extends
     protected void processOperator( Operator operator, List<COSBase> operands) throws
IOException
     {
         String operation = operator.getName();
-        if( "Do".equals(operation) )
+        if (OperatorName.DRAW_OBJECT.equals(operation))
         {
             COSName objectName = (COSName) operands.get( 0 );
             PDXObject xobject = getResources().getXObject( objectName );

Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java?rev=1857952&r1=1857951&r2=1857952&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java
(original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/util/RemoveAllText.java
Mon Apr 22 11:29:23 2019
@@ -24,6 +24,7 @@ import java.util.List;
 
 import org.apache.pdfbox.contentstream.PDContentStream;
 import org.apache.pdfbox.contentstream.operator.Operator;
+import org.apache.pdfbox.contentstream.operator.OperatorName;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdfparser.PDFStreamParser;
 import org.apache.pdfbox.pdfwriter.ContentStreamWriter;
@@ -130,9 +131,10 @@ public final class RemoveAllText
             if (token instanceof Operator)
             {
                 Operator op = (Operator) token;
-                if ("TJ".equals(op.getName()) ||
-                    "Tj".equals(op.getName()) ||
-                    "'".equals(op.getName()))
+                String opName = op.getName();
+                if (OperatorName.SHOW_TEXT_ADJUSTED.equals(opName)
+                        || OperatorName.SHOW_TEXT.equals(opName)
+                        || OperatorName.SHOW_TEXT_LINE.equals(opName))
                 {
                     // remove the argument to this operator
                     newTokens.remove(newTokens.size() - 1);
@@ -140,7 +142,7 @@ public final class RemoveAllText
                     token = parser.parseNextToken();
                     continue;
                 }
-                else if ("\"".equals(op.getName()))
+                else if (OperatorName.SHOW_TEXT_LINE_AND_SPACE.equals(opName))
                 {
                     // remove the 3 arguments to this operator
                     newTokens.remove(newTokens.size() - 1);



Mime
View raw message