ライセンス| .netのAspose.Page

評価バージョンの制限

購入前に顧客にコンポーネントを徹底的にテストしてほしいので、評価バージョンを使用すると、通常どおりに使用できます。ただし、無認定製品:

クラシックライセンス

ライセンスは、ファイルまたはストリーム オブジェクトから読み込むことができます。ライセンスを設定する最も簡単な方法は、以下の例に示すように、ライセンス ファイルを Aspose.Page.dll ファイルと同じフォルダーに置き、パスなしでファイル名を指定することです。

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

ライセンスを適用する最も簡単な方法は、ライセンスファイルを Aspose.Page.dll ファイルと同じフォルダーに配置し、パスを指定せずにファイル名のみを指定することです。

Aspose.Page for .NET と他の Aspose for .NET コンポーネントを併用する場合は、ライセンスの名前空間(Aspose.Page.License など)を指定してください。

1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
2// The path to the documents directory.
3string dataDir = RunExamples.GetDataDir_GettingStarted();
4// Initialize license object
5License license = new License();
6// Set license
7license.SetLicense("D:\\Aspose.Total.NET.lic");
8Console.WriteLine("License set successfully.");

SetLicense メソッドを呼び出す際は、ライセンスファイルと同じライセンス名を渡す必要があります。例えば、ライセンスファイル名を「Aspose.Page.lic.xml」に変更した場合は、そのファイル名を license.SetLicense(…) メソッドに渡します。

ストリームオブジェクトからのライセンスの読み込み

次の例は、ストリームからライセンスを読み込む方法を示しています。

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
 2// The path to the documents directory.
 3string dataDir = RunExamples.GetDataDir_GettingStarted();
 4// Initialize license object
 5Aspose.Page.License license = new Aspose.Page.License();
 6// Load license in FileStream
 7FileStream myStream = new FileStream("Aspose.Total.NET.lic", FileMode.Open);
 8// Set license
 9license.SetLicense(myStream);
10Console.WriteLine("License set successfully.");

埋め込みリソースとして使用する

ライセンスを適用するには、ファイルまたはストリームから読み込む ことができます。ライセンスをアプリケーションにパッケージ化するもう 1 つの便利な方法は、Aspose.Page for .NET を呼び出すアセンブリの 1 つに、ライセンスを埋め込みリソースとして含めることです。

ファイルを埋め込みリソースとして含めるには:

  1. Visual Studio .NET で、[ファイル] メニューをクリックし、[既存の項目の追加] を選択して、.lic ファイルをプロジェクトに含めます。
  2. ソリューション エクスプローラーでファイルを選択します。
  3. プロパティ ウィンドウで、[ビルド アクション] を [埋め込みリソース] に設定します。

MergedAPI はアプリケーションの既定の名前空間です。

 1// For complete examples and data files, please go to https://github.com/aspose-xps/Aspose.XPS-for-.NET
 2// The path to the documents directory.
 3string dataDir = RunExamples.GetDataDir_GettingStarted();
 4// Initialize license object
 5Aspose.Xps.License license = new Aspose.Xps.License();
 6// Set license
 7license.SetLicense("MergedAPI.Aspose.Total.lic");
 8// Set the value to indicate that license will be embedded in the application
 9license.Embedded = true;
10Console.WriteLine("License set successfully.");

考慮すべき点が1つあります。埋め込みリソースは、追加された方法でアセンブリに組み込まれることに注意してください。つまり、テキストファイルをアプリケーションに埋め込みリソースとして追加し、生成されたEXEファイルをメモ帳で開くと、テキストファイルの内容がそのまま表示されます。そのため、ライセンスファイルを埋め込みリソースとして使用すると、誰でも.exeファイルを簡単なテキストエディターで開き、埋め込まれたライセンスの内容を確認/抽出できます。

したがって、ライセンスをアプリケーションに埋め込む際にセキュリティをさらに強化するには、ライセンスを圧縮/暗号化してからアセンブリに埋め込むことができます。無料のユーティリティ DotNetZip ( http://dotnetzip.codeplex.com/) は、この要件を満たすのに役立ちます。Aspose.Total.NET.lic ライセンスファイルがあると仮定します。パスワード test を設定した Aspose.Total.NET.lic.zip を作成し、この zip ファイルをソリューションに埋め込みます。ライセンスの初期化には、以下のコードスニペットを使用できます。

 1// For complete examples and data files, please go to https://github.com/aspose-page/Aspose.Page-for-.NET
 2// The path to the documents directory.
 3string dataDir = RunExamples.GetDataDir_GettingStarted();
 4// Initialize license object
 5Aspose.Page.License license = new Aspose.Page.License();
 6// Set license
 7license.SetLicense("MergedAPI.Aspose.Total.NET.lic");
 8// Set the value to indicate that license will be embedded in the application
 9license.Embedded = true;
10Console.WriteLine("License set successfully.");

従量制ライセンス

Aspose.Page では、開発者が従量制キーを適用できます。これは新しいライセンスメカニズムです。この新しいライセンスメカニズムは、既存のライセンス方式と併用されます。API 機能の使用量に基づいて課金されたいお客様は、従量制ライセンスをご利用いただけます。詳細については、 従量制ライセンスに関するFAQセクションをご覧ください。

従量制キーを適用するための新しいクラスMeteredが導入されました。以下は、従量制公開キーと秘密キーの設定方法を示すサンプルコードです。

1// set metered public and private keys
2Aspose.Page.Metered metered = new Aspose.Page.Metered();
3// Access the setMeteredKey property and pass public and private keys as parameters
4metered.SetMeteredKey(
5    "<type public key here>",
6    "<type private key here>");

Have any questions about Aspose.Page?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.