Package com.dotcms.repackage.org.apache.pdfbox.util

Examples of com.dotcms.repackage.org.apache.pdfbox.util.PDFTextStripper


            PDDocument pdDoc= parser.getPDDocument();

        StringWriter stringWriter = new StringWriter();

        PDFTextStripper stripper = new PDFTextStripper();
        stripper.setLineSeparator("\n");
        stripper.writeText(pdDoc, stringWriter);

        text = stringWriter.toString();

        stringWriter.close();
        pdDoc.close();
      }
      catch (Exception e) {
        _log.error(e.getMessage());
      }
    }
    else if (fileExt.equals(".rtf")) {
      try {
        DefaultStyledDocument dsd = new DefaultStyledDocument();

        RTFEditorKit rtfEditorKit = new RTFEditorKit();
        rtfEditorKit.read(reader, dsd, 0);

        text = dsd.getText(0, dsd.getLength());
      }
      catch (Exception e) {
        _log.error(e.getMessage());
      }
    }
    else if (fileExt.equals(".xls")) {
      try {
        XLSTextStripper stripper = new XLSTextStripper(fis);

        text = stripper.getText();
      }
      catch (Exception e) {
        _log.error(e.getMessage());
      }
    }
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.apache.pdfbox.util.PDFTextStripper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.