Product_box extract text

Source: Internet
Author: User

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 ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.