Solem
Solem

Reputation: 17

iText trial license does not exist in namespace Itext

The type or namespace name 'License' does not exist in the namespace 'iText' (are you missing an assembly reference?)

Here's my .csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net9.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="itext" Version="9.0.0" />
    <PackageReference Include="itext.licensing.base" Version="4.2.0" />
  </ItemGroup>

</Project>

Here's my console app:

using System;
using System.IO;
using iText.License;

class Program {
    static void Main(string[] args) {
        try {
            // Load the iText license key
            LicenseKey.LoadLicenseFile(new FileInfo("itextkey.json"));

            // Your iText code here
            Console.WriteLine("License successfully loaded!");
        } catch (Exception ex) {
            Console.WriteLine($"Error loading license: {ex.Message}");
        }
    }
}

I just requested for iText trial, it is as a iTextCore

itextkeyDOTjson

This is the guide I followed:

https://kb.itextpdf.com/itext/installing-the-itext-license-key-and-license-key-l

Why am I getting this error?

/TestProject/Program.cs(3,13): error CS0234: The type or namespace name 'License' does not exist in the namespace 'iText' (are you missing an assembly reference?)

I added this

dotnet add package itext --version 9.0.0
dotnet add package itext.licensing.base --version 4.2.0

Upvotes: 0

Views: 25

Answers (0)

Related Questions