Aspose::Words::License::SetLicense method

License::SetLicense(const System::SharedPtr<System::IO::Stream>&) method

Licenses the component.

void Aspose::Words::License::SetLicense(const System::SharedPtr<System::IO::Stream> &stream)
ParameterTypeDescription
streamconst System::SharedPtr<System::IO::Stream>&A stream that contains the license.

Remarks

Use this method to load a license from a stream.

Examples

Shows how to initialize a license for Aspose.Words from a stream.

// Set the license for our Aspose.Words product by passing a stream for a valid license file in our local file system.
{
    SharedPtr<System::IO::Stream> myStream = System::IO::File::OpenRead(System::IO::Path::Combine(LicenseDir, u"Aspose.Words.Cpp.lic"));
    auto license = MakeObject<License>();
    license->SetLicense(myStream);
}

See Also

License::SetLicense(const System::String&) method

Licenses the component.

void Aspose::Words::License::SetLicense(const System::String &licenseName)
ParameterTypeDescription
licenseNameconst System::String&Can be a full or short file name. Use an empty string to switch to evaluation mode.

Remarks

Tries to find the license in the following locations:

  1. Explicit path.
  2. The folder that contains the Aspose.Words library.
  3. The folder that contains the client’s application.

Examples

Shows how initialize a license for Aspose.Words using a license file in the local file system.

// Set the license for our Aspose.Words product by passing the local file system filename of a valid license file.
String licenseFileName = System::IO::Path::Combine(LicenseDir, u"Aspose.Words.Cpp.lic");

auto license = MakeObject<License>();
license->SetLicense(licenseFileName);

// Create a copy of our license file in the binaries folder of our application.
String licenseCopyFileName = System::IO::Path::Combine(AssemblyDir, u"Aspose.Words.Cpp.lic");
System::IO::File::Copy(licenseFileName, licenseCopyFileName);

// If we pass a file's name without a path,
// the SetLicense will search several local file system locations for this file.
// One of those locations will be the "bin" folder, which contains a copy of our license file.
license->SetLicense(u"Aspose.Words.Cpp.lic");

See Also

License::SetLicense(std::basic_istream<CharType, Traits>&) method

template<typename CharType,typename Traits> void Aspose::Words::License::SetLicense(std::basic_istream<CharType, Traits> &stream)

See Also