DEV Community

Dmitry Matuzko
Dmitry Matuzko

Posted on

2 1

Introduction to Aspose.CAD, Part 2

If you're willing to use full version of Aspose.CAD API, you'll need to apply your license in your software that uses Aspose.CAD library. In this article I'll show how to do this. It's simple!

There are two types of licenses, one is a traditional license file that is paid upfront, and another is a pay-per-use service key license, called Metered license. Let's dive a little deeper.

License file

This one is very simple to implement. Just include these lines in your project somewhere:

            License license = new Aspose.CAD.License();
            // Pass path to license file
            license.SetLicense("Aspose.CAD.lic");
Enter fullscreen mode Exit fullscreen mode

After execution of these lines your Aspose.CAD libary will work in licensed mode, no file complexity limit, no watermark. As such, you'd probably want to put these lines somewhere within your software's startup code, before any other use of Aspose.CAD. SetLicense also accepts FileStream, so you can perform IO in code that's separate from license setup.

Metered license

This is a license that measures amount of use of the Aspose.CAD libary, and syncs with Aspose licensing service to perform billing on per-use basis. It also lets you measure the registered amount of use. Everything is done via a static Metered class Take a look:

            // Set public and private keys in Metered class
            Aspose.CAD.Metered.SetMeteredKey("*****", "*****");

            // Get metered data amount before calling API
            decimal amountbefore = Aspose.CAD.Metered.GetConsumptionQuantity();

            // Display information
            Console.WriteLine("Amount Consumed Before: " + amountbefore.ToString());


            // Do processing
            //Aspose.CAD.FileFormats.Cad.CadImage image = (Aspose.CAD.FileFormats.Cad.CadImage)Aspose.CAD.Image.load("BlockRefDgn.dwg");


            // Get metered data amount After calling API
            decimal amountafter = Aspose.CAD.Metered.GetConsumptionQuantity();

            // Display information
            Console.WriteLine("Amount Consumed After: " + amountafter.ToString());
Enter fullscreen mode Exit fullscreen mode

As you see, it's equally simple to use.

That's all for now, stay tuned!

For more examples please visit the Aspose.CAD GitHub page. There's also Twitter and Facebook pages for news on Aspose.CAD.

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay