PDF NET Library Converter

Making a PDF in a C# .NET Library is easy and efficient with the right guides. Using IronPDF, we're able to create and edit PDF features in a simple manner according to our application requirements. Here's a tutorial example of how to use the software efficiently in your project and create a PDF with just one button click!

Code Examples

PDF NET Generator
using IronPdf;
using System.Windows.Forms;

namespace readpdf
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			//Used HTMLtoPDF Convert Class
			var HtmlLine = new HtmlToPdf();

			//Getting Text from TextBox
			string text = textBox1.Text;

			//Here we are rendering or converting htmlaspdf.
			HtmlLine.RenderHtmlAsPdf("<h1>"+text+"</h1>").SaveAs("custom.pdf");

			//Confirmation
			MessageBox.Show("Done !");
		}
	}
}
Imports IronPdf
Imports System.Windows.Forms

Namespace readpdf
	Partial Public Class Form1
		Inherits Form

		Public Sub New()
			InitializeComponent()
		End Sub

		Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			'Used HTMLtoPDF Convert Class
			Dim HtmlLine = New HtmlToPdf()

			'Getting Text from TextBox
'INSTANT VB NOTE: The variable text was renamed since Visual Basic does not handle local variables named the same as class members well:
			Dim text_Conflict As String = textBox1.Text

			'Here we are rendering or converting htmlaspdf.
			HtmlLine.RenderHtmlAsPdf("<h1>" & text_Conflict &"</h1>").SaveAs("custom.pdf")

			'Confirmation
			MessageBox.Show("Done !")
		End Sub
	End Class
End Namespace
Jump to Article
Try IronPDF free for development


Step 1

1. Install the IronPDF C# .NET Library

IronPDF provides a suite of functionality with its C# .NET PDF Library, and provides it free for developers to experiment and optimize their projects before deployment. The two main ways of accessing the library are either:

  1. Download and unpack the DLL file

  2. Navigate NuGet and install the package via Visual Studio.


 PM > Install-Package IronPdf


How to Tutorial

2. Use the PDF .NET Library

Now that we have the software, we can generate PDF, adjust settings, add custom text and images, and manipulate the PDFs to our project requirements.

In the below code, we have used a C# Form demonstrating simply how to create a PDF with C# .Net library. In this, we have a textbox to write our own text, and then just click on a button to make a PDF.

using IronPdf;
using System.Windows.Forms;

namespace readpdf
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, System.EventArgs e)
        {
            //Used HTMLtoPDF Convert Class
            var HtmlLine = new HtmlToPdf();

            //Getting Text from TextBox
            string text = textBox1.Text;

            //Here we are rendering or converting htmlaspdf.
            HtmlLine.RenderHtmlAsPdf("<h1>"+text+"</h1>").SaveAs("custom.pdf");

            //Confirmation
            MessageBox.Show("Done !");
        }
    }
}
Imports IronPdf
Imports System.Windows.Forms

Namespace readpdf
	Partial Public Class Form1
		Inherits Form

		Public Sub New()
			InitializeComponent()
		End Sub

		Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			'Used HTMLtoPDF Convert Class
			Dim HtmlLine = New HtmlToPdf()

			'Getting Text from TextBox
'INSTANT VB NOTE: The variable text was renamed since Visual Basic does not handle local variables named the same as class members well:
			Dim text_Conflict As String = textBox1.Text

			'Here we are rendering or converting htmlaspdf.
			HtmlLine.RenderHtmlAsPdf("<h1>" & text_Conflict &"</h1>").SaveAs("custom.pdf")

			'Confirmation
			MessageBox.Show("Done !")
		End Sub
	End Class
End Namespace
VB   C#


3. C# Form to PDF

We have used a C# form to show you the perfect output with custom text. In just a single click, the text in textBox gets converted to a custom PDF. This requires only a single line code function and is easy to understand.

~ C# Form ~

~ PDF ~


Library Quick Access

Share Object Reference

Read through and share the Object Reference for all the functionality you need to work with PDFs in your .NET project.

Share Object Reference