pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1640619 - in /pdfbox/trunk: pdfbox/src/test/java/org/apache/pdfbox/pdmodel/ pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/ pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/ pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics...
Date Wed, 19 Nov 2014 19:17:04 GMT
Author: lehmi
Date: Wed Nov 19 19:17:04 2014
New Revision: 1640619

URL: http://svn.apache.org/r1640619
Log:
PDFBOX-2430: switch to use the non-sequential parser

Modified:
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestEmbeddedFiles.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PDFCloneUtilityTest.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PageExtractorTest.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestPDFToImage.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestRendering.java
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java
    pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestFDF.java Wed Nov 19 19:17:04
2014
@@ -98,7 +98,7 @@ public class TestFDF extends TestCase
             PDDocument fdeb = null;
             try
             {
-                fdeb = PDDocument.loadLegacy( filePDF );
+                fdeb = PDDocument.load( filePDF );
                 PDAcroForm form = fdeb.getDocumentCatalog().getAcroForm();
                 PDTextField field = (PDTextField)form.getField( "f67_1" );
                 field.setValue( "2" );
@@ -139,7 +139,7 @@ public class TestFDF extends TestCase
             PDDocument fdeb = null;
             try
             {
-                fdeb = PDDocument.loadLegacy( filePDF );
+                fdeb = PDDocument.load( filePDF );
                 PDAcroForm form = fdeb.getDocumentCatalog().getAcroForm();
                 PDTextField feld2 = (PDTextField)form.getField( "Feld.2" );
                 feld2.setValue( "Benjamin" );
@@ -210,7 +210,7 @@ public class TestFDF extends TestCase
             FDFDocument fdf = null;
             try
             {
-                freedom = PDDocument.loadLegacy( filePDF );
+                freedom = PDDocument.load( filePDF );
                 fdf = FDFDocument.load( fileFDF );
                 PDAcroForm form = freedom.getDocumentCatalog().getAcroForm();
                 form.importFDF( fdf );

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocument.java Wed Nov
19 19:17:04 2014
@@ -64,7 +64,7 @@ public class TestPDDocument extends Test
         assertEquals("%%EOF\n", new String(Arrays.copyOfRange(pdf, pdf.length - 6, pdf.length),
"UTF-8"));
 
         // Load
-        PDDocument loadDoc = PDDocument.loadLegacy(new ByteArrayInputStream(pdf));
+        PDDocument loadDoc = PDDocument.load(new ByteArrayInputStream(pdf));
         assertEquals(1, loadDoc.getNumberOfPages());
         loadDoc.close();
     }
@@ -93,7 +93,7 @@ public class TestPDDocument extends Test
         assertEquals("%%EOF\n", new String(Arrays.copyOfRange(pdf, pdf.length - 6, pdf.length),
"UTF-8"));
 
         // Load
-        PDDocument loadDoc = PDDocument.loadLegacy(targetFile);
+        PDDocument loadDoc = PDDocument.load(targetFile);
         assertEquals(1, loadDoc.getNumberOfPages());
         loadDoc.close();
     }

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentCatalog.java
Wed Nov 19 19:17:04 2014
@@ -28,7 +28,7 @@ public class TestPDDocumentCatalog exten
     public void testPageLabels() throws Exception {
         PDDocument doc = null;
         try {
-            doc = PDDocument.loadLegacy(TestPDDocumentCatalog.class.getResourceAsStream("test_pagelabels.pdf"));
+            doc = PDDocument.load(TestPDDocumentCatalog.class.getResourceAsStream("test_pagelabels.pdf"));
             PDDocumentCatalog cat = doc.getDocumentCatalog();
             String[] labels = cat.getPageLabels().getLabelsByPageIndices();
             assertEquals(12, labels.length);
@@ -58,7 +58,7 @@ public class TestPDDocumentCatalog exten
     public void testLabelsOnMalformedPdf() throws Exception {
         PDDocument doc = null;
         try {
-            doc = PDDocument.loadLegacy(TestPDDocumentCatalog.class.getResourceAsStream("page_label.pdf"));
+            doc = PDDocument.load(TestPDDocumentCatalog.class.getResourceAsStream("page_label.pdf"));
             PDDocumentCatalog cat = doc.getDocumentCatalog();
             // getLabelsByPageIndices() should not throw an exception
             cat.getPageLabels().getLabelsByPageIndices();
@@ -79,7 +79,7 @@ public class TestPDDocumentCatalog exten
     public void testGetNumberOfPages() throws Exception {
         PDDocument doc = null;
         try {
-            doc = PDDocument.loadLegacy(TestPDDocumentCatalog.class.getResourceAsStream("test.unc.pdf"));
+            doc = PDDocument.load(TestPDDocumentCatalog.class.getResourceAsStream("test.unc.pdf"));
             assertEquals(4, doc.getNumberOfPages());
         } finally {
             if(doc != null)

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/TestPDDocumentInformation.java
Wed Nov 19 19:17:04 2014
@@ -34,7 +34,7 @@ public class TestPDDocumentInformation e
         try
         {
            // This document has been selected for this test as it contains custom metadata.
-           doc = PDDocument.loadLegacy( new File("src/test/resources/input/hello3.pdf"));
+           doc = PDDocument.load( new File("src/test/resources/input/hello3.pdf"));
            PDDocumentInformation info = doc.getDocumentInformation();
            
            assertEquals("Wrong author",            "Brian Carrier", info.getAuthor());

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestEmbeddedFiles.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestEmbeddedFiles.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestEmbeddedFiles.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/common/TestEmbeddedFiles.java
Wed Nov 19 19:17:04 2014
@@ -40,7 +40,7 @@ public class TestEmbeddedFiles extends T
         boolean ok = false;
         try
         {
-            PDDocument doc = PDDocument.loadLegacy(TestEmbeddedFiles.class.getResourceAsStream(
+            PDDocument doc = PDDocument.load(TestEmbeddedFiles.class.getResourceAsStream(
                 "null_PDComplexFileSpecification.pdf"));
 
             PDDocumentCatalog catalog = doc.getDocumentCatalog();
@@ -79,7 +79,7 @@ public class TestEmbeddedFiles extends T
         PDEmbeddedFile dosFile = null;
         PDEmbeddedFile unixFile = null;
 
-        PDDocument doc = PDDocument.loadLegacy(TestEmbeddedFiles.class
+        PDDocument doc = PDDocument.load(TestEmbeddedFiles.class
                 .getResourceAsStream("testPDF_multiFormatEmbFiles.pdf"));
 
         PDDocumentCatalog catalog = doc.getDocumentCatalog();

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/font/PDFontTest.java Wed Nov
19 19:17:04 2014
@@ -67,7 +67,7 @@ public class PDFontTest
         PDDocument doc = null;
         try
         {
-            doc = PDDocument.loadLegacy(PDFontTest.class.getResourceAsStream("F001u_3_7j.pdf"));
+            doc = PDDocument.load(PDFontTest.class.getResourceAsStream("F001u_3_7j.pdf"));
             PDFRenderer renderer = new PDFRenderer(doc);
             renderer.renderImage(0);
             // the allegation is that renderImage() will crash the JVM or hang
@@ -90,7 +90,7 @@ public class PDFontTest
         PDDocument doc = null;
         try
         {
-            doc = PDDocument.loadLegacy(PDFontTest.class.getResourceAsStream("256.pdf"));
+            doc = PDDocument.load(PDFontTest.class.getResourceAsStream("256.pdf"));
             PDFRenderer renderer = new PDFRenderer(doc);
             renderer.renderImage(0);
             // the allegation is that renderImage() will crash the JVM or hang

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java
(original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdmodel/graphics/optionalcontent/TestOptionalContentGroups.java
Wed Nov 19 19:17:04 2014
@@ -166,7 +166,7 @@ public class TestOptionalContentGroups e
             testOCGGeneration();
         }
 
-        PDDocument doc = PDDocument.loadLegacy(pdfFile);
+        PDDocument doc = PDDocument.load(pdfFile);
         try
         {
             assertEquals("%PDF-1.5", doc.getDocument().getHeaderString());

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PDFCloneUtilityTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PDFCloneUtilityTest.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PDFCloneUtilityTest.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PDFCloneUtilityTest.java Wed
Nov 19 19:17:04 2014
@@ -88,9 +88,9 @@ public class PDFCloneUtilityTest extends
 
         // save and reload PDF, so that one can see that the files are legit
         dstDoc.save(TESTDIR + CLONEDST);
-        PDDocument.loadLegacy(new File(TESTDIR + CLONESRC)).close();
+        PDDocument.load(new File(TESTDIR + CLONESRC)).close();
         PDDocument.load(new File(TESTDIR + CLONESRC), null).close();
-        PDDocument.loadLegacy(new File(TESTDIR + CLONEDST)).close();
+        PDDocument.load(new File(TESTDIR + CLONEDST)).close();
         PDDocument.load(new File(TESTDIR + CLONEDST), null).close();
     }
 }

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PageExtractorTest.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PageExtractorTest.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PageExtractorTest.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/PageExtractorTest.java Wed Nov
19 19:17:04 2014
@@ -63,13 +63,8 @@ public class PageExtractorTest extends T
         PDDocument sourcePdf = null;
         PDDocument result = null;
         try {
-            try {
-                // this should work for most users
-                sourcePdf = PDDocument.loadLegacy(new File("src/test/resources/input/cweb.pdf"));
-            } catch(IOException e) {
-                // in case your directory structure is different, just change this to be
the correct path
-                sourcePdf = PDDocument.loadLegacy(new File("pdfbox/pdfbox/src/test/resources/input/cweb.pdf"));
-            }
+            // this should work for most users
+            sourcePdf = PDDocument.load(new File("src/test/resources/input/cweb.pdf"));
             PageExtractor instance = new PageExtractor(sourcePdf);
             result = instance.extract();
             assertEquals(sourcePdf.getNumberOfPages(), result.getNumberOfPages());

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestLayerUtility.java Wed Nov
19 19:17:04 2014
@@ -87,7 +87,7 @@ public class TestLayerUtility extends Te
             overlay1Doc.close();
         }
 
-        PDDocument doc = PDDocument.loadLegacy(targetFile);
+        PDDocument doc = PDDocument.load(targetFile);
         try
         {
             PDDocumentCatalog catalog = doc.getDocumentCatalog();

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestPDFToImage.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestPDFToImage.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestPDFToImage.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestPDFToImage.java Wed Nov 19
19:17:04 2014
@@ -215,7 +215,7 @@ public class TestPDFToImage extends Test
             {
                 // Check for version difference between load() and loadNonSeq()
                 new FileOutputStream(new File(outDir + file.getName() + ".parseseqerror")).close();
-                PDDocument doc2 = PDDocument.loadLegacy(file);
+                PDDocument doc2 = PDDocument.load(file);
                 if (doc2.getDocument().getVersion() != document.getDocument().getVersion())
                 {
                     new FileOutputStream(new File(outDir + file.getName() + ".versiondiff")).close();

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestRendering.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestRendering.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestRendering.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestRendering.java Wed Nov 19
19:17:04 2014
@@ -73,9 +73,9 @@ public class TestRendering
     public void render() throws IOException
     {
         File file = new File(INPUT_DIR, fileName);
-        PDDocument document = PDDocument.loadLegacy(file);
+        PDDocument document = PDDocument.load(file);
         PDFRenderer renderer = new PDFRenderer(document);
-        BufferedImage image = renderer.renderImage(0);
+        renderer.renderImage(0);
 
         // We don't actually do anything with the image for the same reason that
         // TestPDFToImage is disabled - different JVMs produce different results

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/util/TestTextStripper.java Wed Nov
19 19:17:04 2014
@@ -229,7 +229,7 @@ public class TestTextStripper extends Te
         }
 
         //System.out.println("  " + inFile + (bSort ? " (sorted)" : ""));
-        PDDocument document = PDDocument.loadLegacy(inFile);
+        PDDocument document = PDDocument.load(inFile);
         try
         {
             

Modified: pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java?rev=1640619&r1=1640618&r2=1640619&view=diff
==============================================================================
--- pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
(original)
+++ pdfbox/trunk/tools/src/test/java/org/apache/pdfbox/tools/imageio/TestImageIOUtils.java
Wed Nov 19 19:17:04 2014
@@ -108,7 +108,7 @@ public class TestImageIOUtils extends Te
         try
         {
             float dpi = 36; // low DPI so that rendering is FAST
-            document = PDDocument.loadLegacy(file);
+            document = PDDocument.load(file);
 
             // Save image resources of first page
             checkSaveResources(document.getPage(0).getResources());



Mime
View raw message