ライセンスとサブスクリプション

場合によっては、システムをよりよく研究するために、できるだけ早くコードに飛び込みたいと思うことがあります。 これを容易にするために、Aspose.Wordsは購入のための異なる計画を提供するか、または評価のための無料試用版と30日間の一時的なライセンスを提供します。

無料試用版または一時ライセンス

Aspose.Wordsは、開発者が購入する前に試すことができる信じられないほどのソフトウェアです。

無料体験版

評価版は購入したものと同じです- 体験版 ライセンスを適用するために数行のコードを追加すると、単にライセンスされます。

指定されたライセンスのないAspose.Wordsの試用版は、完全な製品機能を提供しますが、ロードと保存時に文書の上部に評価用の透かしを挿入し、最大文書サイ

臨時免許

試用版の制限なしでAspose.Wordsをテストする場合は、30日間の一時ライセンスを要求することもできます。 詳細については、以下を参照してください。 一時的なライセンスを取得する ページ。

購入したライセンス

購入後、ライセンスファイルを適用するか、ライセンスファイルを埋め込みリソースとして含める必要があります。 このセクションでは、これをどのように行うかのオプションについて説明し、いくつかの一般的な質問にもコメントします。

購入したライセンスの保護

ライセンスを購入した後は、ページの情報を注意深く読む必要があります 購入したライセンスの保護 ライセンスファイルを保護するため。 このページは、有料ライセンスをお持ちの場合にのみ表示できます。

ライセンス適用オプション

ライセンスはさまざまな場所から適用できます:

  • 明示的なパス
  • Aspose.Words_\*.dllファイルを含むフォルダ
  • Aspose.Words_\*.dllを呼び出したアセンブリを含むフォルダー
  • エントリアセンブリを含むフォルダ(your.exe)
  • アセンブリ内の埋め込みリソースはAspose.Words_\*.dllと呼ばれます

多くの場合、ライセンスを設定する最も簡単な方法は、ライセンスファイルをAspose.Words_\*.dllと同じフォルダに配置し、パスなしでファイル名だけを指定するこ

ファイルまたはストリームオブジェクトを使用したライセンスの適用

アプリケーションを開発するときは、Aspose.Wordsクラスを使用する前に起動コードでSetLicenseを呼び出します。

ファイルからライセンスをロードする

SetLicenseメソッドを使用すると、埋め込みリソースまたはアセンブリフォルダーでライセンスファイルを検索して、さらに使用できます。

次のコード例は、フォルダーからライセンスを初期化する方法を示しています:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C.git.
auto license = MakeObject<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(u"Aspose.Words.Cpp.lic");
std::cout << "License set successfully." << std::endl;
}
catch (System::Exception& e)
{
// We do not ship any license with this example,
// visit the Aspose site to obtain either a temporary or permanent license.
std::cout << (String(u"\nThere was an error setting the license: ") + e->get_Message()) << std::endl;
}
Streamオブジェクトからライセンスをロードする

次のコード例は、別のSetLicenseメソッドを使用してストリームからライセンスを初期化する方法を示しています:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C.git.
auto license = MakeObject<License>();
try
{
license->SetLicense(MakeObject<System::IO::MemoryStream>(System::IO::File::ReadAllBytes(u"Aspose.Words.Cpp.lic")));
std::cout << "License set successfully." << std::endl;
}
catch (System::Exception& e)
{
// We do not ship any license with this example,
// visit the Aspose site to obtain either a temporary or permanent license.
std::cout << (String(u"\nThere was an error setting the license: ") + e->get_Message()) << std::endl;
}

ライセンスファイルを埋め込みリソースとして含める

ライセンスをアプリケーションにパッケージ化し、それが失われないようにするためのきちんとした方法は、組み込みリソースとして含めることです。 リソースの埋め込みと使用方法は、ターゲットプラットフォームによって異なります。

Windows

以下に示すように、ライセンスをリソースとして追加したとします。

resource.h
#define IDR_ASPOSE_WORDS_LIC            101
resource.rc
IDR_ASPOSE_WORDS_LIC RCDATA "Aspose.Words.Cpp.lic"

次のコード例は、SetLicenseメソッドを使用して埋め込みリソースからライセンスを初期化する方法を示しています:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C.git.
auto hResource = FindResource(nullptr, MAKEINTRESOURCEA(IDR_ASPOSE_WORDS_LIC), RT_RCDATA);
auto hMemory = LoadResource(nullptr, hResource);
auto size = SizeofResource(nullptr, hResource);
auto ptr = LockResource(hMemory);
auto licResource = System::MakeArray<uint8_t>(size);
std::copy_n(static_cast<const uint8_t*>(ptr), size, licResource->begin());
FreeResource(hMemory);
auto license = System::MakeObject<License>();
try
{
license->SetLicense(MakeObject<System::IO::MemoryStream>(licResource));
std::cout << "License set successfully." << std::endl;
}
catch (System::Exception& e)
{
std::cout << (String(u"\nThere was an error setting the license: ") + e->get_Message()) << std::endl;
}
Linux

Linuxのリソースを実行可能ファイルに埋め込むのと同様の方法があります。

次のコードコード例は、SetLicenseメソッドを使用して埋め込みリソースからライセンスを初期化する方法を示しています:

// For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-C.git.
// A file named Aspose.Words.lic is 'imported' into an object file
// using the following command:
//
// ld -r -b binary -o aspose.words.lic.o Aspose.Words.lic
//
// That creates an object file named "aspose.words.lic.o" with the following
// symbols:
//
// _binary_aspose_words_lic_start
// _binary_aspose_words_lic_end
// _binary_aspose_words_lic_size
//
// Note that the symbols are addresses
extern uint8_t _binary_aspose_words_lic_start[];
extern uint8_t _binary_aspose_words_lic_end[];
extern uint8_t _binary_aspose_words_lic_size[];
std::ptrdiff_t size = _binary_aspose_words_lic_end - _binary_aspose_words_lic_start;
auto licResource = System::MakeArray<uint8_t>(size);
std::copy(_binary_aspose_words_lic_start, _binary_aspose_words_lic_end, licResource->begin());
auto license = MakeObject<License>();
try
{
license->SetLicense(MakeObject<System::IO::MemoryStream>(licResource));
std::cout << "License set successfully." << std::endl;
}
catch (System::Exception& e)
{
std::cout << (String(u"\nThere was an error setting the license: ") + e->get_Message()) << std::endl;
}

ライセンスファイル名の変更

ライセンスファイル名は"Aspose.Words.LIC"である必要はありません。 お好みに合わせて名前を変更し、アプリケーションでライセンスを設定するときにその名前を使用できます。

「ライセンスファイル名が見つかりません」例外

ライセンスを購入してダウンロードすると、Aspose webサイトはライセンスファイル*“Aspose.Words.LIC”*に名前を付けます。 ブラウザを使用してライセンスファイルをダウンロードします。 この場合、一部のブラウザはライセンスファイルをXMLとして認識し、追加します。xml拡張子を持つため、コンピュータ上の完全なファイル名は*“Aspose.Words.lic.XML”*になります。

Microsoft Windows が既知のファイル タイプの拡張子を非表示にするように構成されている場合 (残念ながら、ほとんどの Windows インストールではこれがデフォルトです)、ライセンス ファイルは Windows Explorer で “Aspose.Words. LIC” として表示されます。おそらく、これが実際のファイル名であると考えて、“Aspose.Words.LIC” を渡して SetLicense を呼び出しますが、そのようなファイルは存在しないため、例外が発生します。

この問題を解決するには、ファイルの名前を変更して目に見えないものを削除します。xml拡張子。 また、Microsoft Windowsの"拡張機能を非表示"オプションを無効にすることをお勧めします。

複数のAspose製品の使用

Aspose.WordsやAspose.Cellsなど、アプリケーションで複数のAspose製品を使用する場合、以下にいくつかの便利なヒントを示します:

  • Aspose製品ごとにライセンスを個別に設定します。 すべてのコンポーネントに対して単一のライセンスファイル(たとえば「Aspose.Total.lic」)がある場合でも、アプリケーションで使用するAspose製品ごとにSetLicenseを個別に呼び出
  • 完全修飾ライセンスクラス名を使用します。 各Aspose製品には、独自の名前空間にLicenseクラスがあります。 たとえば、Aspose.WordsにはAspose.Words.Licenseがあり、Aspose.CellsにはAspose.Cellsがあります。ライセンスクラス。 完全修飾クラス名を使用すると、どのライセンスがどの製品に適用されるかについての混乱を避けることができます。