/**
* blob--->pdf
*
* @param blob
* @return
* @throws SQLException
* @throws IOException
* @see [类、类#方法、类#成员]
*/
public static String pdf2String(Blob blob)
throws SQLException, IOException
{
InputStream input = blob.getBinaryStream();
PDDocument pdfDocument = PDDocument.load(input);
StringWriter writer = new StringWriter();
PDFTextStripper stripper = new PDFTextStripper();
stripper.writeText(pdfDocument, writer);
String contents = writer.getBuffer().toString();
// System.out.println("文档内容:" + contents);
PDDocumentInformation documentInformation = pdfDocument.getDocumentInformation();
// System.out.println("标题:" + documentInformation.getTitle());
pdfDocument.close();
return contents;
}
java将oracle数据库blob--->pdf
最新推荐文章于 2024-06-18 09:01:03 发布