
You will see the welcome page with a “Generate PDF” button.

It will be the name of our output PDF file. In our case, we provide the name as “ Example.pdf”. And then, we save the file using the SaveAs function, and in the parameter, we provide the file's name. In the parameter, we provide the HTML string. After that we use RenderHtmlAsPdf function for converting HTML to PDF. So, we create an object of HtmlToPdf class. In the above code, we are converting HTML content to create a PDF. Renderer.RenderHtmlAsPdf("This is test file").SaveAs("Example.pdf") Now create a post-action with the name of OnPostGeneratePDF and write the following code in the file: public void OnPost GeneratePDF() To create the action, go to the file and import IronPDF at the top of the code file for using IronPDF by writing this line of code. Now it's time to write post-action to generate PDF. We have created a button for generating PDFs. And set the text on the button “Generate PDF.” And create an input with the type Submit, which converts the input to a button. įirst of all, a form created in a div and set the page location by using asp-page property to index page. We will write the following code on the “Index.cshtml” page for that purpose. We will create a button for generating PDFs. Let’s see how we can use it in the ASP.NET core application. Now, our project is ready to use IronPDF. For confirmation that IronPDF has been installed, expand the Dependencies section in Solution Explorer and click on the Packages section. After installation, you will be able to use IronPDF in your project. Go to the NuGet command line, write the following statement, and hit enter button.


The easiest way to install IronPDF is using the NuGet command line. There are multiple ways to install the IronPDF library. NET 6.0 framework and click on create button.īy following the steps, you’ll be able to create an ASP.NET core application on your local machine.
