pdfbox-commits mailing list archives

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

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

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

Modified: pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java?rev=1855044&r1=1855043&r2=1855044&view=diff
==============================================================================
--- pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
(original)
+++ pdfbox/branches/2.0/examples/src/main/java/org/apache/pdfbox/examples/signature/ShowSignature.java
Fri Mar  8 14:08:06 2019
@@ -47,6 +47,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;
@@ -124,7 +126,12 @@ public final class ShowSignature
             PDDocument document = null;
             try
             {
-                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();
+                document = parser.getPDDocument();
                 for (PDSignature sig : document.getSignatureDictionaries())
                 {
                     COSDictionary sigDict = sig.getCOSObject();



Mime
View raw message