Net pdf creator7/28/2023 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. Give a proper name to your application.From the template list, select ASP.NET Core Web App.Open Visual Studio and click the “Create New Project” button.Create an ASP.NET Core Web Appįollow the following steps for creating ASP.NET Core Web App. Let’s see how we can use it in the ASP.NET core application for generating the PDF file. It gives developers the power to convert web pages into PDFs or build PDF files from scratch in ASP.NET core without knowing anything about Adobe Acrobat or any other third-party software. IronPDF can be used with ASP.NET core to create PDF documents in a way that HTML pages are built. This product offers the solution for developers who wish to export HTML content into a PDF file. IronPDF is a C PDF library that allows you to create PDFs without using Adobe Acrobat. We will use the IronPDF library for generating PDF files in the ASP.NET core application. This article describes how to create PDF documents at runtime in ASP.NET core using C#.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |