我正在尝试使用VB.NET将XSL-FO转换为PDF,我正在使用AppacheFOP.NET将XSL-FO转换为PDF,但这会引发错误:
“ java.io.File”的类型初始值设定项引发了异常。
自从我放置网站池应用程序v4.5 / CLR v4以来出现此错误。
我的代码:
Private Function GeneratePDF(ByVal streamFO As IO.Stream, ByVal pdfFile As String) As Boolean
'OLD Dim streamFO As java.io.FileInputStream = New java.io.FileInputStream(foFile)
Dim memStreamFo As ApacheFop.Net.tools.DotNetInputStream = New ApacheFop.Net.tools.DotNetInputStream(streamFO)
Dim src As org.xml.sax.InputSource = New org.xml.sax.InputSource(memStreamFo)
Dim streamOut As java.io.FileOutputStream = New java.io.FileOutputStream(pdfFile)
Dim oDriver As org.apache.fop.apps.Driver = New org.apache.fop.apps.Driver(src, streamOut)
oDriver.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF)
Try
oDriver.run()
BCreated = True
Catch ex As Exception
BCreated = False
Finally
streamOut.close()
streamFO.close()
oDriver.reset()
GC.Collect()
End Try
End Function
我需要使用FOP,因为我所有的xsl已经完成,所以如何在框架4.5中使用该.dll?