pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1640539 - in /pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools: DecompressObjectstreams.java ExportFDF.java ExportXFDF.java ImportFDF.java ImportXFDF.java PrintPDF.java
Date Wed, 19 Nov 2014 13:08:59 GMT
Author: lehmi
Date: Wed Nov 19 13:08:58 2014
New Revision: 1640539

URL: http://svn.apache.org/r1640539
Log:
PDFBOX-2430: switched all tools without a parser switch to use the non-sequential parser

Modified:
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/DecompressObjectstreams.java
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportFDF.java
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportXFDF.java
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportFDF.java
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportXFDF.java
    pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PrintPDF.java

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/DecompressObjectstreams.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/DecompressObjectstreams.java?rev=1640539&r1=1640538&r2=1640539&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/DecompressObjectstreams.java
(original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/DecompressObjectstreams.java
Wed Nov 19 13:08:58 2014
@@ -17,6 +17,8 @@
 
 package org.apache.pdfbox.tools;
 
+import java.io.File;
+
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.cos.COSObject;
 import org.apache.pdfbox.cos.COSStream;
@@ -31,9 +33,10 @@ import org.apache.pdfbox.persistence.uti
  * it possible to easily look through a PDF using a text editor.  It also exposes
  * problems which stem from objects inside object streams overwriting other
  * objects.
- * @author <a href="adam@apache.org">Adam Nichols</a>
+ * @author Adam Nichols
  */
-public class DecompressObjectstreams {
+public class DecompressObjectstreams 
+{
 
     /**
      * This is a very simple program, so everything is in the main method.
@@ -59,7 +62,7 @@ public class DecompressObjectstreams {
 
         PDDocument doc = null;
         try {
-            doc = PDDocument.load(inputFilename);
+            doc = PDDocument.loadNonSeq(new File(inputFilename));
             for(COSObject objStream : doc.getDocument().getObjectsByType(COSName.OBJ_STM))
{
                 COSStream stream = (COSStream)objStream.getObject();
                 PDFObjectStreamParser sp = new PDFObjectStreamParser(stream, doc.getDocument());

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportFDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportFDF.java?rev=1640539&r1=1640538&r2=1640539&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportFDF.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportFDF.java Wed Nov 19 13:08:58
2014
@@ -16,20 +16,18 @@
  */
 package org.apache.pdfbox.tools;
 
+import java.io.File;
 import java.io.IOException;
 
 import org.apache.pdfbox.pdmodel.PDDocument;
-
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
-
 import org.apache.pdfbox.pdmodel.fdf.FDFDocument;
 
 /**
  * This example will take a PDF document and fill the fields with data from the
  * FDF fields.
  *
- * @author <a href="ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.3 $
+ * @author Ben Litchfield
  */
 public class ExportFDF
 {
@@ -71,7 +69,7 @@ public class ExportFDF
             }
             else
             {
-                pdf = PDDocument.load( args[0] );
+                pdf = PDDocument.loadNonSeq( new File(args[0]) );
                 PDAcroForm form = pdf.getDocumentCatalog().getAcroForm();
                 if( form == null )
                 {

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportXFDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportXFDF.java?rev=1640539&r1=1640538&r2=1640539&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportXFDF.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ExportXFDF.java Wed Nov 19 13:08:58
2014
@@ -16,20 +16,18 @@
  */
 package org.apache.pdfbox.tools;
 
+import java.io.File;
 import java.io.IOException;
 
 import org.apache.pdfbox.pdmodel.PDDocument;
-
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
-
 import org.apache.pdfbox.pdmodel.fdf.FDFDocument;
 
 /**
  * This example will take a PDF document and fill the fields with data from the
  * FDF fields.
  *
- * @author <a href="ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.3 $
+ * @author Ben Litchfield
  */
 public class ExportXFDF
 {
@@ -71,7 +69,7 @@ public class ExportXFDF
             }
             else
             {
-                pdf = PDDocument.load( args[0] );
+                pdf = PDDocument.loadNonSeq( new File(args[0]) );
                 PDAcroForm form = pdf.getDocumentCatalog().getAcroForm();
                 if( form == null )
                 {

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportFDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportFDF.java?rev=1640539&r1=1640538&r2=1640539&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportFDF.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportFDF.java Wed Nov 19 13:08:58
2014
@@ -16,21 +16,19 @@
  */
 package org.apache.pdfbox.tools;
 
+import java.io.File;
 import java.io.IOException;
 
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
-
 import org.apache.pdfbox.pdmodel.fdf.FDFDocument;
-
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 
 /**
  * This example will take a PDF document and fill the fields with data from the
  * FDF fields.
  *
- * @author <a href="ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.2 $
+ * @author Ben Litchfield
  */
 public class ImportFDF
 {
@@ -91,7 +89,7 @@ public class ImportFDF
             {
                 ImportFDF importer = new ImportFDF();
 
-                pdf = PDDocument.load( args[0] );
+                pdf = PDDocument.loadNonSeq( new File(args[0]) );
                 fdf = FDFDocument.load( args[1] );
                 importer.importFDF( pdf, fdf );
 

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportXFDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportXFDF.java?rev=1640539&r1=1640538&r2=1640539&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportXFDF.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/ImportXFDF.java Wed Nov 19 13:08:58
2014
@@ -18,11 +18,10 @@ package org.apache.pdfbox.tools;
 
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
-
 import org.apache.pdfbox.pdmodel.fdf.FDFDocument;
-
 import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
 
+import java.io.File;
 import java.io.IOException;
 
 
@@ -30,8 +29,7 @@ import java.io.IOException;
  * This example will take a PDF document and fill the fields with data from the
  * XFDF fields.
  *
- * @author <a href="ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.2 $
+ * @author Ben Litchfield
  */
 public class ImportXFDF
 {
@@ -91,7 +89,7 @@ public class ImportXFDF
             else
             {
                 ImportFDF importer = new ImportFDF();
-                pdf = PDDocument.load( args[0] );
+                pdf = PDDocument.loadNonSeq( new File(args[0]) );
                 fdf = FDFDocument.loadXFDF( args[1] );
 
                 importer.importFDF( pdf, fdf );

Modified: pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PrintPDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PrintPDF.java?rev=1640539&r1=1640538&r2=1640539&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PrintPDF.java (original)
+++ pdfbox/trunk/tools/src/main/java/org/apache/pdfbox/tools/PrintPDF.java Wed Nov 19 13:08:58
2014
@@ -22,7 +22,6 @@ import java.io.File;
 import javax.print.PrintService;
 
 import org.apache.pdfbox.pdmodel.PDDocument;
-import org.apache.pdfbox.pdmodel.encryption.StandardDecryptionMaterial;
 import org.apache.pdfbox.printing.PDFPrinter;
 
 /**
@@ -98,13 +97,7 @@ public class PrintPDF
         PDDocument document = null;
         try
         {
-            document = PDDocument.load(pdfFile);
-
-            if (document.isEncrypted())
-            {
-                StandardDecryptionMaterial sdm = new StandardDecryptionMaterial(password);
-                document.openProtection(sdm);
-            }
+            document = PDDocument.loadNonSeq(new File(pdfFile), password);
 
             PrinterJob printJob = PrinterJob.getPrinterJob();
             printJob.setJobName(new File(pdfFile).getName());



Mime
View raw message