l am trying to retrieve a BLOB column from a Oracle table, the colums contains TIFF image, and i am trying to render this Image from the DB to a PDF, this is my code, and i get this

java.io.IOException: Could not find a recognized imageformat.
if (rs.next()) {
   ImagenBlob = rs.getBlob(1);
   int longitud = (int) ImagenBlob.length();

   ByteArrayOutputStream flujoBytes = new ByteArrayOutputStream();
   byte[] datos = ImagenBlob.getBytes((long) 1, longitud);

   for (int i = 0; i < longitud; i++) {
       flujoBytes.write((int) datos[i]);
   }

   Document doc=new Document();
   ByteArrayOutputStream output=new ByteArrayOutputStream();
   PdfWriter writer=PdfWriter.getInstance(doc,output);

   Image img=Image.getInstance(datos);
   doc.open();
   doc.add(new Paragraph("que paso don waro"));
   doc.add(img);
   doc.close();
   response.setContentType("application/pdf");
   response.setContentLength(output.size());
   output.writeTo(response.getOutputStream());
   response.getOutputStream().flush();
}




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to