我正在使用一段时间的包,它工作正常。 更新到最新的Package后,代码崩溃了。crispin.Fop Apache Fop C#端口
一些默认的构造函数初始化 工厂后,我得到一个错误:
'org.apache.fop.render.ImageHandlerRegistry' threw an exception.
任何人有一个想法configuratin应该如何看待像这样它会再次合作?
public string GeneratePdf(string foFile, string pdfFile)
{
OutputStream os = new BufferedOutputStream(new FileOutputStream(new java.io.File(pdfFile)));
string ret = "";
try
{
// Factory before update
FopFactory fopFactory = FopFactory.newInstance();
// After the update the Factory needs some sort of configuration
// I tryed with all the constructors but can't get the sample to work.
FopFactory fopFactory = FopFactory.newInstance(null);
Fop fop = fopFactory.newFop("application/pdf", os);
FOUserAgent foUserAgent = fop.getUserAgent();
javax.xml.transform.TransformerFactory factory = javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.Transformer transformer = factory.newTransformer();
javax.xml.transform.Source src = new javax.xml.transform.stream.StreamSource(new java.io.File(foFile));
javax.xml.transform.Result res = new javax.xml.transform.sax.SAXResult(fop.getDefaultHandler());
transformer.transform(src, res);
ret = pdfFile;
}
catch (Exception ex)
{
throw ex;
}
finally
{
os.close();
}
return ret;
}