读书人

●fop.apps.Driver不能实例化高手相

发布时间: 2012-02-26 20:19:45 作者: rapoo

●●●fop.apps.Driver不能实例化,高手相助,我有很多可用分●●●
org.apache.fop.apps.Driver的问题,代码如下:

。。。。。。
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Options;
。。。。。。

public class FopServlet{

public FopServlet(
String strDir,
String strFileName
) throws Exception
{

FileOutputStream fos = new FileOutputStream(strDir + "\\ " + strFileName + ".pdf ");
fos.write(renderFO(strDir, strFileName));
fos.close();
}

public static byte[] renderFO(String strDir,
String strFileName
) throws Exception, FOPException {


Logger log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN);

MessageHandler.setScreenLogger(log);

ByteArrayOutputStream baos = new ByteArrayOutputStream();

InputSource foFile = new InputSource(strDir + "\\ " + strFileName + ".fo ");

File userconfig = new File( "D:\\WS\\conf\\userconfig.xml ");

Driver driver = new Driver(foFile, baos); // <---------在此出错!!!

driver.setLogger(log);

driver.setRenderer(Driver.RENDER_PDF);

driver.run();

return baos.toByteArray();

}

}

通常fop.apps.Driver不能实例化的原因是什么?
怎样对付这个难题??
请出手,分还有!!


[解决办法]
是不是new Driver(foFile, baos) 这个构造函数的参数有错,比如说参数类型不正确等,建议查一下fop.apps.Driver这个类。
[解决办法]
唉~~你也别这样啊 ~
我帮你顶顶
CSDN上现在的人都去灌水了
那还有人来真正的回答问题呢 !
给我给点吧 你随便给 想给多少给多少!
------解决方案--------------------


我没用过FOP
但是Driver driver = new Driver(foFile, baos);这里出错是不是因为你传入参数问题呢?查帮助吧 有没有这个构造方法 Driver这个类是你自己写的??
你不用给我分的 我不能帮你解决问题。。。。。
[解决办法]
ding

读书人网 >Eclipse开发

热点推荐