Aspose.Pdf.Kit license works- but not the one for Aspose.Pdf

Hi,

My application have been using Aspose.Pdf.Kit and now we have added also Aspose.Pdf.

I set the licenses at the start of the application (pointing at the .lic files path) and it throws no error. Initially it was only one license needed (Aspose.Pdf.Kit) but later we added the license for the new API (Aspose.Pdf). Code is next:

// Code that runs on application startup

// Instantiate the Aspose.Pdf and Aspose.Pdf.Kit License class

Aspose.Pdf.License licenseAsposePdf = new Aspose.Pdf.License();
Aspose.Pdf.Kit.License licenseAsposePdfKit = new Aspose.Pdf.Kit.License();


// Pass only the name of the license file embedded in the assembly

licenseAsposePdf.SetLicense("…\Resources\Aspose.Pdf.lic");
licenseAsposePdfKit.SetLicense("…\Resources\Aspose.Pdf.Kit.lic");

Later, before using a function from Aspose.Pdf API, the code always sets again the license first, by including next method:


public void UseLicense()
{
// Instantiate the Aspose License class

Aspose.Pdf.License license = new Aspose.Pdf.License();

// Pass only the name of the license file embedded in the assembly

license.SetLicense(“Aspose.Pdf.lic”);

}

… and it throws the exception Cannot find license ‘Aspose.Pdf.lic’.

I have a similar method for setting Aspose.Pdf.Kit’s license, and it works fine without exceptions.

Both license files (Aspose.Pdf and Aspose.Pdf.Kit) are placed at same path, and they have the same permissions. Also, their functions are invoked at the same class, so I can’t find why one of them works but not the other.

Could it be a problem with the Aspose.Pdf.lic file itself?

Regards.


Hi,

I am not sure why you are facing problem while accessing the license file for Aspose.Pdf. Can you please check that in UseLicense() method you have provided the correct path to Aspose.Pdf.Lic file, and in case you still face any problem, please share the license file so that we can test the issue at our end.

Please visit the following link for information on How to send a license?

Hi,

I have tested the scenario and in my case the license file is working correctly and I am able to use it successfully. As I’ve mentioned earlier, please make sure you are providing the correct path for the license file.

Incase of any further issue, please feel free to contact.

Hi,

I think the path is correct. As I said before, I use 2 licenses with same folder path (and different file name, of course), and one of them works while the other doesn’t.

The exception stack trace says:

at Aspose.Pdf.ᤅ.ᤢ(String ᤖ, Assembly ᤣ)
at Aspose.Pdf.ᤅ.ᤕ(String ᤖ, Assembly ᤗ)
at Aspose.Pdf.License.SetLicense(String licenseName)

Could it be a problem with the version? The Aspose.Pdf.dll is 3.8.0.0

Regards.


I use next code to debug the problem:

// Aspose.Pdf.Kit: no problem

Aspose.Pdf.Kit.License license2 = new Aspose.Pdf.Kit.License();
license2.SetLicense(“Aspose.Pdf.Kit.lic”);

// Aspose.Pdf

Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(“Aspose.Pdf.lic”); // <-------------------- here is the exception!!!


Before that, the application loads the license files when it starts up without any problem, by executing next code:

Aspose.Pdf.License licenseAsposePdf = new Aspose.Pdf.License();
Aspose.Pdf.Kit.License licenseAsposePdfKit = new Aspose.Pdf.Kit.License();

licenseAsposePdf.SetLicense("…\Resources\Aspose.Pdf.lic");
licenseAsposePdfKit.SetLicense("…\Resources\Aspose.Pdf.Kit.lic");

Both .lic files are placed under same folder (\Resources) and with same permissions.

Any suggestion, please? I don’t know where to look at right now.


Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I am not sure why you are facing this problem. Please spare us little time, as we are investigating the reasons that could have generated this problem. Soon you will be update with the status of correction.

Your patience in this regard is highly appreciated.

Hi,

It is really strange. Can you please test it with full path for license file? If it still won't work please share you project (without the license) and let us test it.

Hi,

I have specified the full path and it works, thanks.

At the same time, I still don’t understand why it’s a problem with just one of the licenses.

I’ll keep on investigating and I’ll get back to you if I come up with further questions.

Regards.

Hi,

The only way to make it work for Aspose.Pdf.lic is to specify the full path.

With Aspose.Pdf.Kit I could specify the full path just once, at application’s start up. Later, I could just introduce the name of the file, but not the full path. Then I guess the license was retrieved from the assembly (or?):

license.SetLicense(“Aspose.Pdf.Kit.lic”);

My next questions are: is it a problem to refer the .lic file full path each time the application invokes a function from Aspose API? could there be perfomance problems?

Regards.

Yes… it’s me again.

I have read again the documentation. After that, I have placed the .lic file not only where it’s loaded at start up, but also at same runtime folder of the calling component… and it works. It works without specifying the full path.

I don’t know yet the reason why it operates well with one .lic and not with the other, but now it’s fixed and I don’t need to change the code, which is really good.

Thanks for all your quick responses. Also, next time I’ll read better the documentation before I send more questions. Finally, I beg you a pardon if I was too pushy.

Regards


Hi,

I am glad you have resolved the problem. It is our pleasure to help you. Please feel free to ask further questions.

Best regards.