Description
When I am parsing the RTF file, it only prints last three characters of the first line.Remaining lines are printed properly.
Following is the RTF file text. Please copy the text and save as RTF format.
{\rtf1\ansi\ansicpg1252\uc1\deff0 {\rtf1\ansi\deff0 {\fonttbl{\f0 Arial;}}\f0 {\line
{\b Level1}: \par}
{\line This is level1 paragraph\line This is level1 paragraph\line This is level1 paragraph\line This is level1 paragraph\line This is level1 paragraph\line This is level1 paragraph\par}{\line
{\b Level2}: \par} This is level2 paragraph.\line This is level2 paragraph.\line This is level2 paragraph.\par} } \line \par}
When you save this text as RTF file it will look like this.
https://i.stack.imgur.com/p1rWe.png
I have parsed above RTF from the following code.
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());
The output of the above code is following.
Attachments
Issue Links
- is related to
-
TIKA-2883 Text not extracted from RTF files
- Resolved