You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2017/10/23 20:18:08 UTC

svn commit: r1813081 - /pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/TestPDFParser.java

Author: tilman
Date: Mon Oct 23 20:18:08 2017
New Revision: 1813081

URL: http://svn.apache.org/viewvc?rev=1813081&view=rev
Log:
PDFBOX-3974: add test for PDFBOX-3977

Modified:
    pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/TestPDFParser.java

Modified: pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/TestPDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/TestPDFParser.java?rev=1813081&r1=1813080&r2=1813081&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/TestPDFParser.java (original)
+++ pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/pdfparser/TestPDFParser.java Mon Oct 23 20:18:08 2017
@@ -436,6 +436,41 @@ public class TestPDFParser
     }
 
     /**
+     * Test whether /Info dictionary is retrieved correctly in brute force search for the
+     * Info/Catalog dictionaries.
+     *
+     * @throws MalformedURLException
+     * @throws IOException
+     */
+    @Test
+    public void testPDFBox3977() throws MalformedURLException, IOException
+    {
+        byte[] byteArray;
+        try
+        {
+            try (InputStream is = new URL("https://issues.apache.org/jira/secure/attachment/12893582/63NGFQRI44HQNPIPEJH5W2TBM6DJZWMI.pdf").openStream())
+            {
+                byteArray = IOUtils.toByteArray(is);
+            }
+        }
+        catch (IOException ex)
+        {
+            System.err.println("URL loading failed, testPDFBox3977 will be skipped");
+            return;
+        }
+
+        try (PDDocument doc = PDDocument.load(byteArray))
+        {
+            PDDocumentInformation di = doc.getDocumentInformation();
+            assertEquals("QuarkXPress(tm) 6.52", di.getCreator());
+            assertEquals("Acrobat Distiller 7.0 pour Macintosh", di.getProducer());
+            assertEquals("Fich sal Fabr corr1 (Page 6)", di.getTitle());
+            assertEquals(DateConverter.toCalendar("D:20070608151915+02'00'"), di.getCreationDate());
+            assertEquals(DateConverter.toCalendar("D:20080604152122+02'00'"), di.getModificationDate());
+        }
+    }
+
+    /**
      * Test parsing the "genko_oc_shiryo1.pdf" file, which is susceptible to regression.
      * 
      * @throws Exception