Rastered PDF无法正确显示

时间:2017-10-10 09:29:30

标签: c# pdf-rasterizer

我们在PDFRasterizer上有许可证,但在对代码进行重新分解后,我们会在图像中得到一个斜杠:

Picture with slash

要激活密钥,C#代码按Stackoverflow article

中所述配置许可证
const string TALL_COMPONENTS_LICENSE_KEY = "SOMETHING-NOT-TO-BE-SHARED";
TallComponents.Licensing.LicenseCollection.Add("PDFRasterizer.NET 3.0 Client Component Key", TALL_COMPONENTS_LICENSE_KEY);

如何再次正确配置许可证以删除图片中的斜杠?

1 个答案:

答案 0 :(得分:2)

从版本控制重建后,似乎也必须正确配置AssemblyInfo.cs。

必须将AssemblyProduct设置为许可证密钥上的产品名称,并且必须将AssemblyCompany设置为您的公司名称。

代码已扩展为:

const string TALL_COMPONENTS_LICENSE_KEY = "SOMETHING";
TallComponents.Licensing.LicenseCollection.Add("PDFRasterizer.NET 3.0 Client Component Key", TALL_COMPONENTS_LICENSE_KEY);

Assembly callingAssembly = Assembly.GetCallingAssembly();
AssemblyProductAttribute product = callingAssembly.GetCustomAttribute<AssemblyProductAttribute>();
AssemblyCompanyAttribute company = callingAssembly.GetCustomAttribute<AssemblyCompanyAttribute>();

if (product.Product != "CONSTANT1")
{
    throw new Exception("The product in the assembly is incorrect.");
}

if (company.Company != "CONSTANT2")
{
    throw new Exception("The company in the assembly is incorrect.");
}

图片不再包含斜杠:

Picture without slash

如果您不知道预期的公司或产品名称,您可以登录以获取pdf光栅化器站点并查看许可证的名称。分配给&#39;之后的文字。由公司名称,分离下划线和装配产品名称的预期值组成。

总是检查组装产品和公司似乎是明智的,因为在重新配置软件项目时很容易忘记它们用于许可检查。如果没有明确地测试它,斜线就不会直接可见。这样,许可证配置问题直接在第一次测试中浮现。

相关问题