Working with Aspose.Drawing in ASP.NET Core Web App

In this article, we will learn how to create and display vector graphics in an ASP.NET Core Web application with razor pages. For creating stunning vector graphics, we will use the Aspose.Drawing library. In this step-by-step guide, we will walk you through the process of integrating Aspose.Drawing into an ASP.NET Core web app.

Understanding Aspose.Drawing for .NET

Aspose.Drawing for .NET is a cross-platform 2D graphics library for drawing vector graphics. It empowers developers to work with vector graphics programmatically. The library allows you to render vector graphics on raster images, such as lines, curves, and figures, as well as text. Images can then be saved in all commonly used graphics formats including BMP, PNG, JPEG, GIF, and TIFF.

How to Create and Display Vector Graphics in ASP.NET Core Web Pages

We can create and display vector graphics in ASP.NET Core web applications by following the steps below:

Create an ASP.NET Core Web App Project

  • Create a new project and select the ASP.NET Core Web App project template.
Select the project template.

Select the project template.

  • After that, write the project name and move to the next step.

  • Finally, select framework .NET 7.0 (Standard Term Support), check the option to Configure for HTTPS, and click on Create button to create the project.

Select project framework

Select project framework

Add Aspose.Drawing NuGet Package

Install Aspose.Drawing for .NET

Install Aspose.Drawing for .NET

Add an Image Drawing Code

  • Open Pages\Index.cshtml.cs and replace its content with the following script.
  • Open Pages\Index.cshtml and replace its content with the following script.

Add the Aspose.Drawing License File

  • Copy your Aspose.Drawing.NET.lic file with Aspose.Drawing licensing information to the project directory. Open this file property from Solution Explorer and set Build Action to Embedded resource.

  • After that, open the Program.cs and add the following code to set the Aspose.Drawing license.

  • Finally, run the application.
Output

Output

Download the Source Code

You can download the complete ASP source code.NET Web application from GitHub.

Get a Free License

If you wish to try the library without any limitations, you can obtain a free temporary license.

Aspose.Drawing – Free Learning Resources

You can explore various other features of the Aspose.Drawing library using the following resources:

Conclusion

In conclusion, Aspose.Drawing is a valuable asset for ASP.NET Web developers looking to incorporate dynamic and visually captivating vector graphics into their web projects. By following the steps provided, you’ll unlock new possibilities in web development with Aspose.Drawing. In case of any ambiguity, please contact us on our free support forum.

See Also