tika-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkühler (JIRA) <j...@apache.org>
Subject [jira] [Commented] (TIKA-1098) not able to parse pdfs/docs/ppts using 1.1 tika parser‏‏
Date Wed, 18 Mar 2015 21:24:38 GMT

    [ https://issues.apache.org/jira/browse/TIKA-1098?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14367950#comment-14367950
] 

Andreas Lehmkühler commented on TIKA-1098:
------------------------------------------

The parser stumbles upon a malformed annotation
{code}
1386 0 obj <<
/Type /Annot
/Border[0 0 0]/H/N/C[.5 .5 .5]
/Rect [307.1979 10.1075 314.1718 19.5der[0 0 0]/H/N/C[.5 .5 .5]
/Rect [276.3138 10.1075 283.2876 19.572]
/Subtype /Link
/A << /S /GoTo /D (Navigation36) >>
>> endobj
{code}
The first rectangle is the problem.

> not able to parse pdfs/docs/ppts using 1.1 tika parser‏‏
> --------------------------------------------------------
>
>                 Key: TIKA-1098
>                 URL: https://issues.apache.org/jira/browse/TIKA-1098
>             Project: Tika
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 1.1
>         Environment: linux redhat
>            Reporter: Qian Diao
>         Attachments: url_1763_approx-alg-notes.pdf
>
>
> Hi,
> I got some parsing problems when using Tika 1.1 for the attached pdf file.
> my code (Test.java):
> import java.io.File;
> import java.io.InputStream;
> import java.io.FileInputStream;
> import org.apache.tika.metadata.Metadata;
> import org.apache.tika.parser.AutoDetectParser;
> import org.apache.tika.parser.ParseContext;
> import org.apache.tika.parser.Parser;
> import org.apache.tika.parser.html.BoilerpipeContentHandler;
> import org.apache.tika.sax.BodyContentHandler;
> import org.apache.tika.parser.html.HtmlParser;
> import de.l3s.boilerpipe.extractors.ArticleExtractor;
> public class Test {
>     private static final String validBoilerpipeFilenameRegEx = ".*(\\.)(htm|html|shtml|php|asp|aspx)$";
>         public String parseFile(File inFile) {
>             if (inFile == null || !inFile.isFile() || !inFile.canRead()) return null;
>                    
>             InputStream is = null;
>             String outputText = "";
>             try {
>                 // Open input stream
>                 is = new FileInputStream(inFile);
>                 // Prepare parser
>                 BodyContentHandler contenthandler = new BodyContentHandler(-1);
>                 Metadata metadata = new Metadata();
>                 metadata.set(Metadata.RESOURCE_NAME_KEY, inFile.getName());
>                 ParseContext pc = new ParseContext();
>                 // Call parse with boilerpipe if valid boilerpipe extension; otherwise,
call regular parse.
>                 if (!inFile.getName().matches(validBoilerpipeFilenameRegEx)) {
>                         Parser parser = new AutoDetectParser();
>                         parser.parse(is, contenthandler, metadata, pc);
>                 }
>                 else {
>                         Parser parser = new HtmlParser();
>                         BoilerpipeContentHandler bh = new BoilerpipeContentHandler(contenthandler,
new ArticleExtractor());
>                         parser.parse(is, bh, metadata, pc);
>                 }
>                 // Prepare text for write
>                 outputText = contenthandler.toString();        
>             } catch (Exception e) {
>                 System.out.println(e);
>                 return null;
>             } finally {
>                 try { 
>                     if (is != null) 
>                         is.close(); 
>                 } catch (Exception e) {}
>             }
>            
>             return outputText;
>         }
> =====output====
> org.apache.tika.exception.TikaException: Unable to extract PDF content
> url_1763_approx-alg-notes.pdf



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message