【问题标题】:Rastered PDF not displaying correctly光栅 PDF 无法正确显示
【发布时间】:2017-10-10 17:36:01
【问题描述】:

我们有 PDFRasterizer 的许可证,但在重构代码后,我们在图像中看到了一个斜线:

要激活密钥,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);

如何再次正确配置license,去掉图片中的斜线?

【问题讨论】:

    标签: c# pdf-rasterizer


    【解决方案1】:

    从版本控制重构后,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.");
    }
    

    图片不再包含斜线:

    当您不知道预期的公司或产品名称时,您可以登录到 pdf rasterizer 站点并查看许可证名称。 “assigned to”后面的文本由公司名称、分隔下划线和装配产品名称的预期值组成。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-28
      • 2017-04-11
      • 1970-01-01
      • 1970-01-01
      • 2021-02-02
      • 1970-01-01
      相关资源
      最近更新 更多