我正在创建这个小应用程序以从数据库生成pdf文件我想将每个图像从数据库BLOB格式放入分离的页面
try
{
String query="select * from papie where id='"+label.getText()+"' ";
PreparedStatement pst=con.prepareStatement(query);
ResultSet rs=pst.executeQuery();
int i=1;
while(rs.next())
{
//if(rs.getString("recto").equals(0))
//{
Blob imageBlob = rs.getBlob("photo");
imageInputStream = imageBlob.getBinaryStream();
doc.addPage(page[i]);
image = new PDJpeg(doc,imageInputStream);
content = new PDPageContentStream(doc, page[i]);
content.drawXObject(image, 100, 555,200, 100);
i++;
}
content.close();
doc.save(fileName);
doc.close();
}
catch(Exception e)
{
System.out.println(e);
}