Hi,

Am 08.02.2012 15:12, schrieb Ilija Pavlic:
POITextExtractor is a custom class of yours and not included in
pdfbox. There is probably something amiss in your code.
I guess it is the wrong mailing list for that question.

You may join the mailing list from the Apache POI project [1] where the POITextExtractor class belongs to.

BR
Andreas Lehmkühler

[1] http://poi.apache.org/

BR,
Ilija.

On Wed, Feb 8, 2012 at 3:10 PM, Jeffrey Zhao<[email protected]>  wrote:
Sorry, wrong code. It's following code for the POI.

        String txt = "";
                POITextExtractor txtExtractor = null;

                try{
                        txtExtractor = ExtractorFactory.createExtractor(in);
                        txt = txtExtractor.getText();
                        txt = txt.trim();
                        txtExtractor = null;
                        //poiFactory = null;
                }catch(Exception e){
                        log.error(e.getMessage(),e);
                }

                txt = txt.trim();

                return txt;


-----Original Message-----
From: Jeffrey Zhao [mailto:[email protected]]
Sent: February 8, 2012 8:56 AM
To: [email protected]
Subject: POI freezing?

I'm using POI to get text contents and having intermittent freezing. The java 
thread calling  this part hangs sometimes.
Have you experience similar problems?  I'm using following code.

            PDFParser parser;
            String parsedText = null;
            PDFTextStripper pdfStripper = null;
            PDDocument pdDoc = null;
            COSDocument cosDoc = null;
            try {
                  parser = new PDFParser(in);
                  parser.parse();
                  cosDoc = parser.getDocument();
                  pdfStripper = new PDFTextStripper();
                  pdDoc = new PDDocument(cosDoc);
                  if(!pdDoc.isEncrypted()){
                        pdfStripper.setStartPage(1);
                        pdfStripper.setEndPage(Integer.MAX_VALUE);
                        parsedText = pdfStripper.getText(pdDoc);
                  }else{
                        log.error("PDF Failed (" + fname+ ") Encrypted");
                  }
            } catch (Exception e) {
                  log.error("PDF Failed (" + fname + ") Error: " + 
e.getMessage());
            } finally {
                  try {
                        if (cosDoc != null){
                              cosDoc.close();
                        }
                        if (pdDoc != null){
                              pdDoc.close();
                        }
                  } catch (Exception e) {
                        log.error("PDF Close (" + fname + ") Error: " + 
e.getMessage());
                  }
            }


Reply via email to