How to use immutable objects in ASP.NET Core MVC 5.You can learn more about DinkToPdf on GitHub. NET Core wrapper for wkhtmltopdf that can be used to convert an HTML template to a PDF document. DinkToPdf is one of many such libraries available.ĭinkToPdf is a. There is no built-in reporting framework in ASP.NET Core 5 or ASP.NET Core MVC 5, so if we want to generate PDF documents, we’ll need to take advantage of a third-party library. The generated report from our example is shown in Figure 2 below. When you run the application and hit the HttpGet endpoint of the ReportController class, a report file will be created and downloaded in your computer. public void ConfigureServices(IServiceCollection services) To do this, you can write the following code in the ConfigureServices method. Now that the DinkToPdf library has been installed on your project, you must register the library with the built-in IoC container. Register the DinkToPdf library with the IoC container Once you’ve installed this library, you can verify the installation by locating the DinkToPdf.dll library as shown in Figure 1 below.įigure 1. You can either install it via the NuGet Package Manager or by using the following command at the NuGet Package Manager Console window. To get started working with the DinkToPdf library, you must install it from NuGet. The DinkToPdf library is available as a NuGet package. We’ll use this project in the subsequent sections in this article. Ensure that the check boxes “Enable Docker,” “Configure for HTTPS,” and “Enable Razor runtime compilation” are unchecked as we won’t be using any of those features here.įollowing these steps will create a new ASP.NET Core MVC 5.0 project. Leave the “Authentication Type” set to None (default). NET 5.0 as the target framework from the drop-down list at the top. In the “Additional Information” window shown next, select.Optionally check the “Place solution and project in the same directory” check box, depending on your preferences.In the “Configure your new project” window, specify the name and location for the new project.In the “Create new project” window, select “ASP.NET Core Web App (Model-View-Controller)” from the list of templates displayed.Following these steps should create a new ASP.NET Core MVC 5 project in Visual Studio 2019. Create an ASP.NET Core MVC 5 project in Visual Studio 2019įirst off, let’s create an ASP.Net Core project in Visual Studio 2019.
0 Comments
Leave a Reply. |