pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1635904 - in /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox: pdfparser/NonSequentialPDFParser.java pdmodel/fdf/FDFDocument.java
Date Sat, 01 Nov 2014 09:11:49 GMT
Author: lehmi
Date: Sat Nov  1 09:11:49 2014
New Revision: 1635904

URL: http://svn.apache.org/r1635904
Log:
PDFBOX-2468: switch FDFDocument to NonSequentialParser, enable FDF support within NonSequentialParser

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
  (contents, props changed)
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java
  (contents, props changed)

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java?rev=1635904&r1=1635903&r2=1635904&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Sat Nov  1 09:11:49 2014
@@ -391,10 +391,20 @@ public class NonSequentialPDFParser exte
             throw new IOException("Missing root object specification in trailer.");
         }
 
-        parseObjectDynamically(root, false);
+        COSBase rootObject = parseObjectDynamically(root, false);
 
-        // ---- resolve all objects (including pages)
-        if (!parseMinimalCatalog)
+        // ---- resolve all objects
+        if (isFDFDocment)
+        {
+        	// A FDF doesn't have a catalog, all FDF fields are within the root object
+            if (rootObject instanceof COSDictionary)
+            {
+                parseDictObjects((COSDictionary) rootObject, (COSName[]) null);
+                allPagesParsed = true;
+                document.setDecrypted();
+            }
+        }
+        else if(!parseMinimalCatalog)
         {
             COSObject catalogObj = document.getCatalog();
             if (catalogObj != null)
@@ -853,18 +863,21 @@ public class NonSequentialPDFParser exte
                 initialParse();
             }
 
-            final int pageCount = getPageNumber();
-
-            if (!allPagesParsed)
+            // a FDF doesn't have any pages
+            if (!isFDFDocment)
             {
-                for (int pNr = 0; pNr < pageCount; pNr++)
-                {
-                    getPage(pNr);
-                }
-                allPagesParsed = true;
-                document.setDecrypted();
+	            final int pageCount = getPageNumber();
+	
+	            if (!allPagesParsed)
+	            {
+	                for (int pNr = 0; pNr < pageCount; pNr++)
+	                {
+	                    getPage(pNr);
+	                }
+	                allPagesParsed = true;
+	                document.setDecrypted();
+	            }
             }
-
             exceptionOccurred = false;
         }
         finally

Propchange: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
------------------------------------------------------------------------------
  Merged /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java:r1635903

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java?rev=1635904&r1=1635903&r2=1635904&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java
Sat Nov  1 09:11:49 2014
@@ -31,15 +31,10 @@ import java.io.Writer;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSDocument;
 import org.apache.pdfbox.cos.COSName;
-
 import org.apache.pdfbox.exceptions.COSVisitorException;
-
-import org.apache.pdfbox.pdfparser.PDFParser;
-
+import org.apache.pdfbox.pdfparser.NonSequentialPDFParser;
 import org.apache.pdfbox.pdfwriter.COSWriter;
-
 import org.apache.pdfbox.util.XMLUtil;
-
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
@@ -47,8 +42,7 @@ import org.w3c.dom.Element;
  * This is the in-memory representation of the FDF document.  You need to call
  * close() on this object when you are done using it!!
  *
- * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
- * @version $Revision: 1.6 $
+ * @author Ben Litchfield
  */
 public class FDFDocument implements Closeable
 {
@@ -203,7 +197,7 @@ public class FDFDocument implements Clos
      */
     public static FDFDocument load( InputStream input ) throws IOException
     {
-        PDFParser parser = new PDFParser( input );
+        NonSequentialPDFParser parser = new NonSequentialPDFParser(input);
         parser.parse();
         return parser.getFDFDocument();
     }

Propchange: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sat Nov  1 09:11:49 2014
@@ -0,0 +1 @@
+/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFDocument.java:1460370,1460372,1461796,1465163,1465217,1465266,1465359-1465360,1465366,1467638,1468195,1469999,1470107,1470242,1476795,1477806,1478472,1479136,1479287,1480000,1480030,1484089,1484277,1484547,1485771,1485781,1486337,1486413,1486423,1486440,1487557,1488049,1490022-1490023,1490408,1493503,1494083,1495799,1495802-1495803,1497532,1504210,1504214,1505737,1509187,1512367,1512433,1512661,1515101,1515165,1515905,1517273,1517281,1517288,1519174,1521194,1528826,1528833,1530018,1530740,1535953,1535956,1536136,1536173,1536441,1536463,1537287,1538191,1538203,1538222,1538341,1538371,1538394-1538395,1540801,1540811,1541625,1541714,1541987,1542291,1542780,1544789,1544806,1544818,1544972,1544977,1548387,1548394,1549022,1549025,1549027,1551220,1552521,1552533,1552552,1553017,1553175,1553220,1554632,1554774,1554792,1554845,1555186,1555345,1555550,1557339,1557374,1557546,1557553,1557561,1557793,1558205,1558570,1561095,156
 1191,1563199,1563210,1563215,1563426,1563429,1564846,1588736,1598655,1598885,1599016,1599656,1599786,1601144,1601451,1631169,1635903



Mime
View raw message