Free Support Forum - aspose.com

Apply licence

I have just bought a developer licence for word and pdf tool and i have to apply the licence key, but i don’t have understood where i must write the follow line of code
(com.aspose.words.License license = new com.aspose.words.License();
license.setLicense(“Aspose.Words.lic”):wink:
and where i can find the file Aspose.Words.dll,thanks.


This message was posted using Page2Forum from Applying a License - Aspose.Words for .NET and Java

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

Thanks for your inquiry. Please see the following links to learn how and when to apply license:

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/applying-a-license.html

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/when-to-apply-a-license.html

You can find Aspose.Words.dll in the following folder on your PC:

C:\Program Files\Aspose\Aspose.Words\Bin\net2.0 or net1.1

If you are using Java version of Aspose.Words (as I see from your code) then there is no dll there is Aspose.Words.jar.

Best regards.

So, i have put the licence key into the folder with Aspose.Words.jar, but i’ m using the aspose features in integration with a Business Process Management (BPM) software and i didn’t understand where i have to put correctly the line code to implement the setlicense method, if you can help me, thanks.

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

Thanks for your inquiry. You need to set a license before performing any operations with documents. Make sure you do it before instantiating a Document object. It is only required to set a license once per application or process. So you should set license when your application starts.

For example if your application is simple console application then you should use th following code:

public class <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />Main {

public static void main(String[] args) throws Exception {

//Set license

License lic = new License();

lic.setLicense("Aspose.Words.lic");

//Build document

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

//Here you should build your document

//.....................................

builder.write("Hello world");

//.....................................

doc.save("out.doc");

}

}

Hope this helps.

Best regards.