Hello ,
Here is the code that cause problem. I create an image with a blob
if(cpas.getLogo()!=null)
{
PdfPCell cell =getPdfPCellImage(getImage(cpas.getLogo(),
Image.NO_BORDER),0, Element.ALIGN_CENTER);
tableHeader.addCell(cell);
}
// first method called
public Image getImage(Blob blob, int imageBorder) throws IOException,
BadElementException, SQLException {
int length = Integer.parseInt(String.valueOf(blob.length()));
byte[] bytes = blob.getBytes(1, length);
java.awt.Image awtImage = Toolkit.getDefaultToolkit
().createImage(bytes);
awtImage = awtImage.getScaledInstance(90, 90, 1);
Image imageIText = Image.getInstance(awtImage, null);
imageIText.setBorder(imageBorder);
return imageIText;
}
//second method called
public PdfPCell getPdfPCellImage(Image image, int border, int alignment) {
PdfPCell cell = new PdfPCell(image, false);
cell.setBorder(border);
cell.setHorizontalAlignment (alignment);
return cell;
}
I have modified the java.policy like this :
grant {
permission java.security.AllPermission;
permission java.lang.RuntimePermission "getClassLoader";
};
but it still does not work.
finally the exception :
ExceptionConverter:
java.io.IOException: The document has no pages.
at com.lowagie.text.pdf.PdfPages .writePageTree(PdfPages.java:118)
at com.lowagie.text.pdf.PdfWriter.close(PdfWriter.java:1303)
at com.lowagie.text.pdf.PdfDocument.close(PdfDocument.java:957)
at com.lowagie.text.Document.close(Unknown Source)
....etc
thank in advance for your support,
philippe vandenhove
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/