ByteArrayOutputStream baos = new ByteArrayOutputStream();
if(!document.isEncrypted())
{
output = new OutputStreamWriter(baos, "UTF-8");
PDFTextStripper stripper = new PDFTextStripper();
//stripper.setSortByPosition( sort );
//stripper.setStartPage( startPage );
//stripper.setEndPage( endPage );
stripper.writeText( document, output );
text = baos.toString("UTF-8");
if(logger.isInfoEnabled())
logger.info("PDF Document has " + text.length() + " chars\n\n" + text);
}
}