pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1641450 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java
Date Mon, 24 Nov 2014 19:36:46 GMT
Author: lehmi
Date: Mon Nov 24 19:36:45 2014
New Revision: 1641450

URL: http://svn.apache.org/r1641450
Log:
PDFBOX-2520: don't automatically decrypt encrypted pdfs, this shall be done by the parser/user
before using PDFTextStripper

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java?rev=1641450&r1=1641449&r2=1641450&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/util/PDFTextStripper.java Mon Nov
24 19:36:45 2014
@@ -40,8 +40,6 @@ import org.apache.pdfbox.pdmodel.PDPage;
 import org.apache.pdfbox.pdmodel.PDPageTree;
 import org.apache.pdfbox.pdmodel.common.PDRectangle;
 import org.apache.pdfbox.pdmodel.common.PDStream;
-import org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException;
-import org.apache.pdfbox.pdmodel.encryption.StandardDecryptionMaterial;
 import org.apache.pdfbox.pdmodel.interactive.documentnavigation.outline.PDOutlineItem;
 import org.apache.pdfbox.pdmodel.interactive.pagenavigation.PDThreadBead;
 import org.apache.pdfbox.text.TextPosition;
@@ -251,24 +249,6 @@ public class PDFTextStripper extends PDF
             articleEnd = lineSeparator;
         }
         startDocument(document);
-
-        if (document.isEncrypted())
-        {
-            // We are expecting non-encrypted documents here, but it is common
-            // for users to pass in a document that is encrypted with an empty
-            // password (such a document appears to not be encrypted by
-            // someone viewing the document, thus the confusion).  We will
-            // attempt to decrypt with the empty password to handle this case.
-            try
-            {
-                StandardDecryptionMaterial sdm = new StandardDecryptionMaterial("");
-                document.openProtection(sdm);
-            }
-            catch (InvalidPasswordException e)
-            {
-                throw new IOException("Invalid password for encrypted document", e);
-            }
-        }
         processPages(document.getPages());
         endDocument(document);
     }



Mime
View raw message