我在加载iText 7&amp ;;的许可证文件时遇到问题。 XFAFlattener
。我已尝试从嵌入式资源流加载xml许可证,并直接从文件系统加载,但没有运气。调用XfaLicenseKey.GetLicenseeInfo()
有效且我在观察窗口中看到了正确的信息,但无论我尝试使用哪种许可文件组合或LicenseKey
或XfaLicenseKey
,我总是会收到以下消息:
{
"ExceptionMessage": "License file for product not loaded.",
"ExceptionType": "iText.License.LicenseKeyException"
}
在iText.License.XfaLicenseKey.CheckLicense(LicenseKeyProduct 产品)\ r \ n at iText.License.XfaLicenseKey.ScheduledCheck(LicenseKeyProduct 产品)\ r \ n at iTextSharp.tool.xml.xtra.xfa.XFAFlattener.InitFlattener(PdfReader 读者)\ r \ n at iTextSharp.tool.xml.xtra.xfa.XFAFlattener.FlattenXDP(PdfReader reader, DataPipeline dataPipeline)\ r \ n at iTextSharp.tool.xml.xtra.xfa.XFAFlattener.Flatten(流 xfaInputStream,Stream pdfOutputStream)
var currentAssembly = Assembly.GetExecutingAssembly();
using (var iTextLicense =
currentAssembly.GetManifestResourceStream("myapp.itextkey-1.xml"))
using (var iTextXfaLicense =
currentAssembly.GetManifestResourceStream("myapp.itextkey-0.xml"))
{
//itext 7 license
LicenseKey.LoadLicenseFile(iTextLicense);
//itext.pdfxfa license
XfaLicenseKey.LoadLicenseFile(iTextXfaLicense);
}