Create PDF in Asp.net C# [HTML to PDF using Spire.PDF ]

Create PDF: This article explains how to create PDF in Asp.net C#. Creating pdf document is a very common task in every web application. And in .NET framework there is no natural way to work with PDF files .i.e (create, read, edit PDF file).

While working on my previous project, I was looking for an Advance Tool, which creates complex PDF Report in C#.Net and then I found Spire.net, so to work with PDF file in our Asp.net Web application we are going to use Spire.PDF.

Intro:

Spire.PDF is a PDF component which contains an incredible wealth of features to create, read, edit and manipulate PDF documents on .NET, Silverlight and WPF Platform.As an independent PDF library, it does not need users to install Adobe Acrobat or any other third party libraries.

Spire.PDF for .NET is completely written in C# but also supports VB.NET, Windows Forms, and ASP.NET Applications. Using Spire.PDF, we can create PDF file programmatically from C# applications very quickly.

Screenshot:

Steps to create PDF in Asp.net C#.

Add HTML Markup under Panel Control.

Download Spire.PDF DLL.

Initialize PDF instance along page setting.

Fetch HTML and generate PDF.

# Add HTML markup under Panel Control:

Here we have a Web Page (.aspx) with some HTML content and by using Spire.PDF will generate PDF i.e (converting HTML to PDF) we can also convert Gridview to PDF in Asp.net C#.

But to create PDF for the particular part of our webpage, here we use Asp.net Panel control. i.e place our HTML tag inside Asp.net Panel control.

This is how our web page markup looks like containing an h1 and p tag under Panel Control.