You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2017/03/17 19:01:39 UTC

[tika] branch master updated (1725007 -> 22f6ccf)

This is an automated email from the ASF dual-hosted git repository.

tallison pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git.

      from  1725007   TIKA-2236 upgrad PDFBox to 2.0.5 and JempBox to 1.8.13
      adds  e9ff4c0   Fix for TIKA-2303 contributed by ppalazon
       new  679e460   Merge branch 'TIKA-2303' of https://github.com/ppalazon/tika
       new  22f6ccf   TIKA-2303 -- allow users to configure whether or not to extract bookmarks via Pablo Palazon. This closes #157

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/tika/parser/pdf/AbstractPDF2XHTML.java  |  5 +++-
 .../java/org/apache/tika/parser/pdf/PDFParser.java |  5 ++++
 .../apache/tika/parser/pdf/PDFParserConfig.java    | 29 ++++++++++++++++++++--
 .../apache/tika/parser/pdf/PDFParser.properties    |  1 +
 .../org/apache/tika/parser/pdf/PDFParserTest.java  | 12 +++++++++
 5 files changed, 49 insertions(+), 3 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@tika.apache.org" <co...@tika.apache.org>'].

[tika] 01/02: Merge branch 'TIKA-2303' of https://github.com/ppalazon/tika

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git

commit 679e460368ef21aa23fabda61f53673c32ed6ed7
Merge: 1725007 e9ff4c0
Author: tballison <ta...@mitre.org>
AuthorDate: Fri Mar 17 14:54:26 2017 -0400

    Merge branch 'TIKA-2303' of https://github.com/ppalazon/tika

 .../apache/tika/parser/pdf/AbstractPDF2XHTML.java  | 10 ++++----
 .../java/org/apache/tika/parser/pdf/PDFParser.java |  5 ++++
 .../apache/tika/parser/pdf/PDFParserConfig.java    | 29 ++++++++++++++++++++--
 .../apache/tika/parser/pdf/PDFParser.properties    |  1 +
 4 files changed, 38 insertions(+), 7 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
"commits@tika.apache.org" <co...@tika.apache.org>.

[tika] 02/02: TIKA-2303 -- allow users to configure whether or not to extract bookmarks via Pablo Palazon. This closes #157

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tallison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tika.git

commit 22f6ccfe09c89c59510a710b2b3560c92a53f334
Author: tballison <ta...@mitre.org>
AuthorDate: Fri Mar 17 15:01:25 2017 -0400

    TIKA-2303 -- allow users to configure whether or not to extract bookmarks via Pablo Palazon. This closes #157
---
 .../java/org/apache/tika/parser/pdf/AbstractPDF2XHTML.java  | 13 ++++++++-----
 .../test/java/org/apache/tika/parser/pdf/PDFParserTest.java | 12 ++++++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/tika-parsers/src/main/java/org/apache/tika/parser/pdf/AbstractPDF2XHTML.java b/tika-parsers/src/main/java/org/apache/tika/parser/pdf/AbstractPDF2XHTML.java
index 4f328df..34cbc42 100644
--- a/tika-parsers/src/main/java/org/apache/tika/parser/pdf/AbstractPDF2XHTML.java
+++ b/tika-parsers/src/main/java/org/apache/tika/parser/pdf/AbstractPDF2XHTML.java
@@ -16,6 +16,9 @@
  */
 package org.apache.tika.parser.pdf;
 
+import static org.apache.tika.parser.pdf.PDFParserConfig.OCR_STRATEGY.NO_OCR;
+
+import javax.xml.stream.XMLStreamException;
 import java.awt.image.BufferedImage;
 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
@@ -35,7 +38,7 @@ import java.util.ListIterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TreeMap;
-import javax.xml.stream.XMLStreamException;
+
 import org.apache.commons.io.IOExceptionWithCause;
 import org.apache.commons.io.IOUtils;
 import org.apache.pdfbox.pdmodel.PDDocument;
@@ -92,8 +95,6 @@ import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
-import static org.apache.tika.parser.pdf.PDFParserConfig.OCR_STRATEGY.NO_OCR;
-
 class AbstractPDF2XHTML extends PDFTextStripper {
 
     enum ActionTrigger {
@@ -522,8 +523,10 @@ class AbstractPDF2XHTML extends PDFTextStripper {
     protected void endDocument(PDDocument pdf) throws IOException {
         try {
             // Extract text for any bookmarks:
-			if(config.getExtractBookmarksText())
-            	extractBookmarkText();
+			if(config.getExtractBookmarksText()) {
+                extractBookmarkText();
+            }
+
             try {
                 extractEmbeddedDocuments(pdf);
             } catch (IOException e) {
diff --git a/tika-parsers/src/test/java/org/apache/tika/parser/pdf/PDFParserTest.java b/tika-parsers/src/test/java/org/apache/tika/parser/pdf/PDFParserTest.java
index 30afc76..2c3dd64 100644
--- a/tika-parsers/src/test/java/org/apache/tika/parser/pdf/PDFParserTest.java
+++ b/tika-parsers/src/test/java/org/apache/tika/parser/pdf/PDFParserTest.java
@@ -513,6 +513,18 @@ public class PDFParserTest extends TikaTest {
         assertTrue(i < j);
     }
 
+    // TIKA-2303
+    @Test
+    public void testTurningOffBookmarks() throws Exception {
+        PDFParserConfig config = new PDFParserConfig();
+        config.setExtractBookmarksText(false);
+        ParseContext parseContext = new ParseContext();
+        parseContext.set(PDFParserConfig.class, config);
+        String xml = getXML("testPDF_bookmarks.pdf", parseContext).xml;
+        assertNotContained("Denmark bookmark is here", xml);
+    }
+
+
     //TIKA-1124
     @Test
     public void testEmbeddedPDFEmbeddingAnotherDocument() throws Exception {

-- 
To stop receiving notification emails like this one, please contact
"commits@tika.apache.org" <co...@tika.apache.org>.