Hello, im currently testing aspose.pdf to see if it suite my needs, but one question I have (haven’t purchased a license yet) is when I do purchase a license and want to destribute my application, how do I include the license with it (c#, aspose.pdf) in a way that my clients cannot retrieve it?
Also, under the license terms, is it allowed for me to embed the aspose.pdf (c#) in a pyhron application? I don’t want to use the python binding as I find it rather slow than my embedding solution.
Hi @Batz1
You can set up a licence from Steam. That means you can choose how to read the license content: from an encrypted file, a resource, a network, etc.
Here is one example of how you can read a licence.
using System;
using System.IO;
using System.IO.Compression;
using System.Reflection;
namespace Aspose.Pdf.Examples
{
class ExampleLicensing
{
public static void LicenseDemo()
{
License license = new License();
license.SetLicense(GetSecureLicenseFromStream());
Document doc = new Document("document.pdf");
//Get the page count of document
Console.WriteLine(doc.Pages.Count);
}
private static Stream GetSecureLicenseFromStream()
{
var assembly = Assembly.GetExecutingAssembly();
var memoryStream = new MemoryStream();
using (var zipToOpen = assembly.GetManifestResourceStream("Aspose.Pdf.Examples.License.Aspose.PDF.zip"))
{
using (ZipArchive archive = new ZipArchive(zipToOpen ?? throw new InvalidOperationException(), ZipArchiveMode.Read))
{
var unpackedLicense = archive.GetEntry("Aspose.PDF.lic");
unpackedLicense?.Open().CopyTo(memoryStream);
}
}
memoryStream.Position = 0;
return memoryStream;
}
}
}