We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

License throws exception


I have a webservice which utilize the Aspose.PDF assembly, but when I call SetLicense this throws an “object reference not set” exception…


Hi Jeppe,

Thanks for using our products.

If you are using/accessing the license as an embedded resource in your project, please ensure that default namespace of project is added as prefix to license file name and also set the value of Embedded property of License class to true. In case you are referencing the license file from some relative path over system, make sure that application has access privileges to access that file. In recent release versions, we have fixed some issues related to license initialization and please ensure that you are using the latest release version.

We are sorry for this inconvenience.

// create a Pdf license object
Aspose.Pdf.License lic = new Aspose.Pdf.License();
// specify the license file name along with Default namespace of application
// set the value to indicate that license will be embedded in the application
lic.Embedded = true;

Where MergedAPI is the default Namespace of my project (Right Click Solution in Solution Explorer and
select Properties. You will see the page with Default Namespace information