Error when trying to set the trial license for Aspose.PDF

I tried an Aspos.pdf trial license on a sample example and I got this error:
System.ArgumentException
Message=Unsupported algorithm

I’m using the source code in the example here:

I modified the https://github.com/aspose-pdf/Aspose.PDF-for-.NET/blob/master/Examples/CSharp/AsposePDF/DocumentConversion/PostscriptToPDF.cs

to load the provided trial license but an exception is thrown when calling the method to set the license:

        // The path to the documents directory.
        string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
        // Initialize license object
        Aspose.Pdf.License license = new Aspose.Pdf.License();
        // Load license in FileStream
        FileStream myStream = new FileStream(dataDir+"Aspose.PDF.NET.lic", FileMode.Open);
        // Set license
        license.SetLicense(myStream);

The license file “Aspose.PDF.NET.lic” was copied to the “DocumentConversion” folder.

Any insight why an “Unsupported algorithm” System.ArgumentException is thrown ?

Thanks
Noureddine

@nfarah

Have you tried to use the license with the latest version? Please update the API version to 23.5 and try again. If issue still persists, please let us know.

Thanks @asad.ali for your answer. Yes I’m using the received trial license on the latest version available on the website (Aspose.PDF.23.5). (Download .NET Component DLL to Process PDF | Aspose.PDF API). May be the received trial license is not compatible with that verson ?

image.png (10.1 KB)
@nfarah

Please share your license with us in a private message as shown in the attached image. We will test the scenario in our environment and address it accordingly.


Hi,

I sent you the license but not sure if it was sent ok. Please confirm.

Thanks
Noureddine Farah

@nfarah

We have received your license file and tested it as well. Its working as expected and no exception is being thrown. Would you please try using file path instead of FileStream and let us know if issue still persists.

Thanks, I just tried using the file path (full path for the license file) and I got the same exception as I had with the FileStream.

Noureddine

@nfarah

Can you please share some details like OS Name and Version, .NET Framework Version? We will again try to replicate it in our environment and address it accordingly.

PS: You can please create a simple console application that is reproducing the issue and share it with us in .zip format.

My OS is Windows 10 and my C# project is targeting .NET 6.0. When I reference the Aspose.PDF assembly I’ve chosen the closest .NET version that is available for that assembly: .NET 4.0. However when I look at the properties of that reference folder, it showed that it did use the .NET 2.0 version.

Here is [the link](https://drive.google.com/file/d/1JCF__xN014hM3XZbVJDJ17QOMUFdxkhX/view?usp=sharing) for sample application that replicate the issue at my end.

@nfarah

We have checked your shared application. The API version which was being used is 20.5. The support for .NET 6.0 was added in 21.11 version of the API. Also, when we installed 23.5 version using NuGet Package manager, the license was set successfully and no error was occurred.

Thanks for the response. Indeed I was using the sample application that was an older .net version of the Aspose.pdf (shipped with it). After I referenced the newer version, the licensing issue was resolved.

Thanks

@nfarah

It is nice to know that your issue has been resolved. Please keep using our API and feel free to create a new topic in case you need further assistance.