Write your own desktop search in the past two daysProgram, Write down some of your problems one after another to prevent future forgetting and making the same mistake again.
Now let's talk about how to extract text from product_box. In the first place, I used the following method to extract text:
Cosdocument cosdoc = NULL;
Fileinputstream is = new fileinputstream (File );
Partition parser = new partition Parser (is );//
Parser. parse (); cosdoc = parser. getdocument (); extends textstripper stripper = new extends textstripper (); string doctext = stripper. gettext (New pddocument (cosdoc); every time I extract a PDF file, an exception is thrown: Java. lang. throwable: Warning: You did not close the PDF document. If the document is constructed according to the following method, no exception occurs: fileinputstream is = new fileinputstream (File );
Required textstripper stripper =
New Extends textstripper (); Required Document = pddocument.
Load(Is ); Stringwriter writer =
New Stringwriter (); Stripper. writetext (Invalid document, Writer ); doctext = writer. getbuffer (). tostring ();