Create and Edit PDF documents in C# and VB.Net
The easiest way to install IronPdf is using NuGet Package Manager for Visual-Studio: The package name is “IronPdf”. https://www.nuget.org/packages/IronPdf/
PM > Install-Package IronPdf
Why IronPdf
Adding PDF file generation in .Net project is cumbersome; converting web forms, HTML and/or online web pages to Pdf is a very hard and complex problem.
IronPdf works with ASP.NET web forms, MVC, Web services, WPF, and secure internet. By using IronPdf you will be able add lots of features and capability to your projects, and produce PDF files as reports or as documents.
HTML String to PDF Example
This example shows just how easy it can be to create a PDF file from .Net.
- using IronPdf;
- IronPdf.HtmlToPdf Renderer = new IronPdf.HtmlToPdf();
- Renderer.RenderHtmlAsPdf(“<h1>Hello World<h1>”).SaveAs(“html-string.pdf”);
Copy code to clipboardVB C#
HTML File to PDF Example
HTML files with images, CSS, forms, hyperlinks and even JavaScript may be rendered into PDF documents.
- using IronPdf;
- // Create a PDF from an existing HTML using C#
- var Renderer = new IronPdf.HtmlToPdf();
- var PDF = Renderer.RenderHTMLFileAsPdf(“Assets/MyHTML.html”);
- PDF.SaveAs(“MyPdf.pdf”);
Copy code to clipboardVB C#
URL to PDF Example
Existing web pages may also be rendered as PDFs in a few lines of C# or VB.Net code
- using IronPdf;
- // Create a PDF from any existing web page
- var Renderer = new IronPdf.HtmlToPdf();
- var PDF = Renderer.RenderUrlAsPdf(“https://en.wikipedia.org/wiki/Portable_Document_Format”);
- PDF.SaveAs(“wikipedia.pdf”);
Copy code to clipboardVB C#
ASP.Net Example
ASP.Net webpages may be marked to be rendered as PDF rather than HTML by using a single of code in the Page_Load code-behind method.
- protected void Page_Load(object sender, EventArgs e)
- {
- IronPdf.AspxToPdf.RenderThisPageAsPdf(IronPdf.AspxToPdf.FileBehavior.InBrowser);
- }
Copy code to clipboardVB C#
C# PDF Cheat Sheet
We have compiled a PDF document that explains in full how to create and edit PDFs in C# and VB.Net using the IronPDF library.
You can download it and use it as a develop guide for your .Net projects, or print it as a handy companion for IronPDF development. This saves time and effort in getting started adding PDF features to any .Net project.
Learn More
To learn more about HTML to PDF in C# or VB.Net applications please read the C# HTML to PDF Tutorial. The tutorial clearly explains the use of advanced PDF settings, HTML templating and the use of CSS, Images and Javascript.
You can also use IronPDF to dynamically render ASPX pages in ASP.Net applications as PDFs in the ASPX to PDF Tutorial
A full object reference for .NET developers is also available.
The C# PDF solution you’ve been looking for.
Human Support
Talk directly with our development team
Documentation
Clear online manuals in plain English.
Simple Licensing
Free development license. Commercial from $399.
Get Started Now
Get started in minutes with NuGet or DLL.