From: <php...@li...> - 2007-03-01 20:06:17
|
Ho Wilfrid, > $cb = $writer->getDirectContent(); > $bf = new Java("com.lowagie.text.pdf.BaseFont"); > $bf->createFont("Helvetica", "Cp1252", false); > $cb->setFontAndSize( $bf , 12); > ... > I got this error: > Fatal error: Uncaught > [o(Exception):"java.lang.Exception: Invoke failed: > [o(PdfContentByte)]->setFontAndSize((BaseFont)c(BaseFont), > (float)o(Float)). > Cause: java.lang.IllegalArgumentException: argument > type mismatch [...] Shouldn't be BaseFont an instance? My guess is that $bf = $bf->createFont(...) should correct this problem. BTW: For backward compatibility the bridge allows sloppy coding: new Java("com.lowagie.text.pdf.BaseFont"); is valid even though the above code should immediately throw an exception. If you set the log level to 3 (which is default), you should see a warning message in the JavaBridge.log file. > It seems '12' is considerated as an Object Float and > not a primitive type > float. It's more likely that the problem is the first argument, not the second. float is autoconverted into a Float, so this shouldn't be the problem. But you're right, the "illegal argument exception" should state which argument is illegal, and why! At the moment we simply pass the exception we've obtained from Java. In the next version, 4.0.2 we should change this: wrap the obtained exception and pass more information to the client. Regards, Jost Boekemeier ___________________________________________________________ Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de |