pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1855043 - /pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
Date Fri, 08 Mar 2019 14:08:01 GMT
Author: tilman
Date: Fri Mar  8 14:08:01 2019
New Revision: 1855043

URL: http://svn.apache.org/viewvc?rev=1855043&view=rev
Log:
PDFBOX-3017: use old-style document loading to disable leniency

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java?rev=1855043&r1=1855042&r2=1855043&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
(original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
Fri Mar  8 14:08:01 2019
@@ -55,6 +55,8 @@ import org.apache.pdfbox.cos.COSString;
 import org.apache.pdfbox.examples.signature.cert.CertificateVerificationException;
 import org.apache.pdfbox.examples.signature.cert.CertificateVerifier;
 import org.apache.pdfbox.io.IOUtils;
+import org.apache.pdfbox.io.RandomAccessBufferedFileInputStream;
+import org.apache.pdfbox.pdfparser.PDFParser;
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
 import org.apache.pdfbox.pdmodel.encryption.SecurityProvider;
@@ -135,7 +137,12 @@ public final class ShowSignature
         {
             String password = args[0];
             File infile = new File(args[1]);
-            try (PDDocument document = PDDocument.load(infile, password))
+            // use old-style document loading to disable leniency
+            RandomAccessBufferedFileInputStream raFile = new RandomAccessBufferedFileInputStream(infile);
+            PDFParser parser = new PDFParser(raFile, password);
+            parser.setLenient(false);
+            parser.parse();
+            try (PDDocument document = parser.getPDDocument())
             {
                 for (PDSignature sig : document.getSignatureDictionaries())
                 {



Mime
View raw message