Apache Tika不提取RTF文件的第一行,它只提取第一行的最后三个字符。

时间:2017-11-10 08:19:43

标签: apache-tika

我在评论中添加了RTF文件。在文本编辑器中复制以下文本并保存为RTF格式。

This is a view of RFT file when you will open in any RTF viewer.

BodyContentHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata();
FileInputStream inputstream = new FileInputStream(new File("level1Missing.rtf"));
ParseContext pcontext = new ParseContext();
RTFParser rt = new RTFParser();
rt.parse(inputstream, handler, metadata, pcontext);
//getting the content of the document
System.out.println("Contents of the PDF :\n\n" + handler.toString());

Output of the above code is.

1 个答案:

答案 0 :(得分:3)

在我看来,Apache Tika没有问题。关键性在rtf文件中;在\par之前有{\line {\b Level1} : \par}次。

您可以尝试使用另一个简单文件:

{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\par
This is some {\b bold} text.\par
}

如果您在\par之前删除This is some {\b bold} text.\par,则tika会提取第一行的最后一个字符。

相关问题