C# 尝试运行免费试用版时,itext7异常许可证文件已损坏
我正在评估itext7 Html2pdf库。我注册了一个免费试用版,下载了itextkey.xml许可证密钥并将其包含在我的项目中 以下是我正在使用的代码:C# 尝试运行免费试用版时,itext7异常许可证文件已损坏,c#,.net,pdf,itext7,C#,.net,Pdf,Itext7,我正在评估itext7 Html2pdf库。我注册了一个免费试用版,下载了itextkey.xml许可证密钥并将其包含在我的项目中 以下是我正在使用的代码: public static readonly string destinationFile = @"C:\Test\Generated.pdf"; public static readonly string sourceHtml = @"C:\Test\djigit.html"; public static readonly string
public static readonly string destinationFile = @"C:\Test\Generated.pdf";
public static readonly string sourceHtml = @"C:\Test\djigit.html";
public static readonly string licenseKey = @"C:\Test\itextkey.xml";
static void Main(string[] args) {
parsePdf(sourceHtml, destinationFile);
}
private static void parsePdf(string htmlSource, string pdfDestionation) {
LicenseKey.LoadLicenseFile(licenseKey);
PdfWriter writer = new PdfWriter(pdfDestionation);
PdfDocument document = new PdfDocument(writer);
HtmlConverter.ConvertToPdf(new FileStream(htmlSource, FileMode.Open), document);
document.Close();
}
当我运行该项目时,会出现以下异常:
iText.License.LicenseKeyException:许可证文件已损坏
为了工作,我包括了itext7文档中描述的所有nuget包:itext7、itext7.licensekey和itext7.pdfhtml
你能告诉我我做错了什么吗 有关许可证密钥的问题,请直接与供应商联系。堆栈溢出用户无法帮助您。此异常最常见的情况是:将iText7许可证与LicenseKey库v1而不是v2一起使用。检查您是否正在使用LicenseKey库的v2