Created
December 5, 2023 11:11
Aspose.Words for .NET. Apply lisence using C#.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git. | |
License license = new License(); | |
// This line attempts to set a license from several locations relative to the executable and Aspose.Words.dll. | |
// You can also use the additional overload to load a license from a stream, this is useful, | |
// for instance, when the license is stored as an embedded resource. | |
try | |
{ | |
license.SetLicense("Aspose.Words.lic"); | |
Console.WriteLine("License set successfully."); | |
} | |
catch (Exception e) | |
{ | |
// We do not ship any license with this example, | |
// visit the Aspose site to obtain either a temporary or permanent license. | |
Console.WriteLine("\nThere was an error setting the license: " + e.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git. | |
License license = new License(); | |
try | |
{ | |
license.SetLicense(new MemoryStream(File.ReadAllBytes("Aspose.Words.lic"))); | |
Console.WriteLine("License set successfully."); | |
} | |
catch (Exception e) | |
{ | |
// We do not ship any license with this example, | |
// visit the Aspose site to obtain either a temporary or permanent license. | |
Console.WriteLine("\nThere was an error setting the license: " + e.Message); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-.NET.git. | |
try | |
{ | |
Metered metered = new Metered(); | |
metered.SetMeteredKey("*****", "*****"); | |
Document doc = new Document(MyDir + "Document.docx"); | |
Console.WriteLine(doc.PageCount); | |
} | |
catch (Exception e) | |
{ | |
Console.WriteLine("\nThere was an error setting the license: " + e.Message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment