I have tested my program with the license and it works, but I don't want to have the .lic file in a directory, I want to add it as a resource to my application. How do I do that? I have looked around and all the samples say that I should have a .licx files with the following text inside:
,
and just compile in with the project. The problem is that Aspose.Pdf is not a component, and the compiler I'm using (Delphi) doesn't seem to like it. Has anyone embedded a license on an application?
BTW, Why isn't the Pdf object derived from System.ComponentModel.Component?
That way it could be used on forms as a non-visual component.
Dear Faw,
Thank you for considering Aspose.Pdf.
Here is an example about using embeded license:
(First add the license file into your project as embeded resource)
Assembly assembly = Assembly.GetCallingAssembly();
string[] resourceNames = assembly.GetManifestResourceNames();
Stream licStream = null;
foreach (string resourceName in resourceNames)
{
if (resourceName.IndexOf("Aspose.Custom.lic") != -1)
licStream = assembly.GetManifestResourceStream(resourceName);
}
if(licStream == null)
throw new ApplicationException("load license error!");
License lic = new License();
lic.SetLicense(licStream);
Thank you. Works perfectly now.