Top
ArticleCity.comArticle Categories Create and Edit PDF documents in C# and VB.Net

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.

  1. using IronPdf;
  2. IronPdf.HtmlToPdf Renderer = new IronPdf.HtmlToPdf();
  3. 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.

  1. using IronPdf;
  2. // Create a PDF from an existing HTML using C#
  3. var Renderer = new IronPdf.HtmlToPdf();
  4. var PDF = Renderer.RenderHTMLFileAsPdf(“Assets/MyHTML.html”);
  5. 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

  1. using IronPdf;
  2. // Create a PDF from any existing web page
  3. var Renderer = new IronPdf.HtmlToPdf();
  4. var PDF = Renderer.RenderUrlAsPdf(“https://en.wikipedia.org/wiki/Portable_Document_Format”);
  5. 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.

  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. IronPdf.AspxToPdf.RenderThisPageAsPdf(IronPdf.AspxToPdf.FileBehavior.InBrowser);
  4. }

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.

.Net Developer Support

Human Support

Talk directly with our development team

Ask a QuestionC# Object Reference and Get Started Tutorials

Documentation

Clear online manuals in plain English.

View DocumentationC# Library Licensing

Simple Licensing

Free development license. Commercial from $399.

Browse OptionsInstall The C# PDF library

Get Started Now

Get started in minutes with NuGet or DLL.

Install & Try Now

No Comments

Sorry, the comment form is closed at this time.