parser.parse();  COSDocument cos = parser.getDocument();  String extractedText = pts .getText(new PDDocument(parser.getDocument()));   cos.close();
try { parser = new PDFParser(source); parser.parse(); extractedText = pts.getText(new PDDocument(parser.getDocument())); } finally { try { parser.getDocument().close(); } catch(Exception e) { log.error("Error closing temporary PDF file: " + e.getMessage(), e); } }
    public InputStream getDestinationStream(InputStream source)            throws Exception    {        // get input stream from bitstream        // pass to filter, get string back        PDFTextStripper pts = new PDFTextStripper();        PDFParser parser = new PDFParser(source);        parser.parse();        COSDocument cos = parser.getDocument();        String extractedText = pts                .getText(new PDDocument(parser.getDocument()));        // now close the pdf        cos.close();        // if verbose flag is set, print out extracted text        // to STDOUT        if (MediaFilterManager.isVerbose)        {            System.out.println(extractedText);        }        // generate an input stream with the extracted text        byte[] textBytes = extractedText.getBytes();        ByteArrayInputStream bais = new ByteArrayInputStream(textBytes);        return bais; // will this work? or will the byte array be out of scope?    }