IRONSOFTWAREHOME

VB.NET PDF Creator (Code Example Tutorial)

Curtis Chau
Curtis Chau
Updated: September 17, 2026

This tutorial will guide you step-by-step on how to create and edit PDF files in VB.NET. This technique is equally valid for use in ASP.NET web apps as well as console applications, Windows Services, and desktop programs. We will use VB.NET to create PDF projects targeting .NET Framework 4.6.2 or .NET Core 2. All you need is a Visual Basic .NET development environment, such as Microsoft Visual Studio Community.

To see how to use IronPDF with C# see this guide.

To see how to use IronPDF with F# see this guide.


Overview

How to Generate PDF Files in VB .NET Library

  1. Download the VB.NET PDF Library
  2. Create a PDF document with VB.NET Library
  3. Customize your PDF document styles
  4. Choose which methods to create dynamic content
  5. Edit your PDF files from VB.NET Library

VB .NET Codes for PDF Creating and Editing with IronPDF

Render HTML to PDF with VB.NET, apply styling, utilize dynamic content, and edit your files easily. Creating PDFs is straightforward and compatible with .NET Framework 4.6.2, .NET Core 3.1, and .NET 5 through 10. And no need for proprietary file formats or dealing with different APIs.

This tutorial provides the documentation to walk you through each task step-by-step, all using the free-for-development IronPDF software favored by developers. VB.NET code examples are specific to your use cases so you can see the steps easily in a familiar environment. This VB .NET PDF library has comprehensive creation and settings capabilities for every project, whether in ASP.NET applications, console, or desktop.

Included with IronPDF:

  • Ticket support direct from our .NET PDF Library development team
  • Works with HTML, ASPX forms, MVC views, images, and all the document formats you already use
  • Microsoft Visual Studio installation gets you up and running fast
  • Unlimited free development, and licenses to go live starting at $999

Step 1

1. Download the VB .NET PDF Library FREE from IronPDF

Start using IronPDF in your project today with a free trial.

First Step:
arrow pointer

Install via NuGet

In Visual Studio, right-click on your project in the Solution Explorer and select "Manage NuGet Packages...". From there simply search for IronPDF and install the latest version... click OK to any dialog boxes that come up.

This will work in any C# .NET Framework project from Framework 4.6.2 and above, or .NET Core 2 and above. It will also work just as well in VB.NET projects.

PM > Install-Package IronPdf

Download IronPDF from NuGet

Install via DLL

Alternatively, the IronPDF DLL can be downloaded and manually installed to the project or GAC from IronPDF Downloads

Remember to add this statement to the top of any VB class file using IronPDF:

Imports IronPdf
VB .NET

How to Tutorials

2. Create a PDF with VB.NET

Using Visual Basic ASP.NET to create a PDF file for the first time is surprisingly easy using IronPDF, as compared to libraries with proprietary design APIs such as iText.

We can use HTML (with a pixel-perfect rendering engine based on Google Chromium) to define the content of our PDF and simply render it to a file.

Here is the basic code to create a PDF in VB.NET:

Module Module1
    Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim document = renderer.RenderHtmlAsPdf("<h1> My First PDF in VB.NET</h1>")
        document.SaveAs("MyFirst.pdf")
    End Sub
End Module
VB .NET

This will produce a .NET-generated PDF file containing your exact text, albeit lacking some design at this point.

To improve upon this code, we can add the following line to open the PDF in the operating system's default PDF viewer:

Imports IronPdf

Module Module1
    Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim document = renderer.RenderHtmlAsPdf("<h1> My First PDF in VB.NET</h1>")
        document.SaveAs("MyFirst.pdf")
        System.Diagnostics.Process.Start("MyFirst.pdf")
    End Sub
End Module
VB .NET

An alternative method would be to render any existing web page from a URL to a PDF by using the elegant RenderUrlAsPdf method from IronPDF.

Imports IronPdf

Module Module1
    Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim document = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf/")
        document.SaveAs("UrlToPdf.pdf")
        System.Diagnostics.Process.Start("UrlToPdf.pdf")
    End Sub
End Module
VB .NET

3. Apply Styling to VB.NET PDF

To style our PDF content in VB.NET, we can make full use of CSS, JavaScript, and images. We may link to local assets, or even to remote or CDN-based assets such as Google Fonts. We can even use DataURIs to embed images and assets as a string into your HTML.

For advanced design, we can use a 2-stage process:

  1. First, we develop and design our HTML perfectly. This task may involve in-house design staff, splitting the workload.
  2. Render that file as a PDF using VB.NET and our PDF library.

The VB.NET Code to render the HTML file as a PDF:

This method renders an HTML document as if it were opened as a file (file:// protocol).

Dim Renderer As New IronPdf.ChromePdfRenderer()
Renderer.RenderingOptions.PaperOrientation = IronPdf.Rendering.PdfPaperOrientation.Landscape 
Renderer.RenderingOptions.CssMediaType = IronPdf.Rendering.PdfCssMediaType.Print 
Dim PDF As IronPdf.PdfDocument = Renderer.RenderUrlAsPdf("file://path-to-your-html-file.html")
PDF.SaveAs("styled-sample.pdf")
VB .NET

4. Create PDF w/ Dynamic Content: 2 Methods

Historically, PDF 'templating' has been an overwhelming task for Software Engineers. Stamping content into PDF templates rarely works because each case or report will contain content of varying types and lengths. Fortunately, HTML is exceptionally good at handling Dynamic Data.

4.1. Method 1 - ASP.NET - ASPX to PDF using VB.NET Web Forms

Any flavor of .NET Web Form (including Razor) can be rendered into a PDF document using this VB.NET code in the Page_Load subroutine in the VB.NET code behind.

Imports IronPdf

Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
    Dim PdfOptions = New IronPdf.ChromePdfRenderOptions()
    IronPdf.AspxToPdf.RenderThisPageAsPDF(AspxToPdf.FileBehavior.Attachment, "MyPdf.pdf", PdfOptions)
End Sub
VB .NET

4.2. Method 2 - HTML to PDF with String Templating

To create dynamic PDF documents that include instance-specific data, we simply create an HTML string to match the data we wish to render as a PDF.

Imports IronPdf

Module Module1
    Sub Main()
        Dim renderer = New ChromePdfRenderer()
        Dim Html = "Hello {0}"
        String.Format(Html, "World")
        Dim document = renderer.RenderHtmlAsPdf(Html)
        document.SaveAs("HtmlTemplate.pdf")
        System.Diagnostics.Process.Start("HtmlTemplate.pdf")
    End Sub
End Module
VB .NET

5. Edit PDF Files with VB.NET

IronPDF for VB.NET also allows PDF documents to be edited, encrypted, watermarked, or even turned back into plain text:

5.1. Merging Multiple PDF Files into One Document in VB

Dim pdfs = New List(Of PdfDocument)
pdfs.Add(PdfDocument.FromFile("A.pdf"))
pdfs.Add(PdfDocument.FromFile("B.pdf"))
pdfs.Add(PdfDocument.FromFile("C.pdf"))
Dim mergedPdf As PdfDocument = PdfDocument.Merge(pdfs)
mergedPdf.SaveAs("merged.pdf")
mergedPdf.Dispose()
For Each pdf As PdfDocument In pdfs
    pdf.Dispose()
Next
VB .NET

5.2. Add a Cover Page to the PDF

pdf.PrependPdf(renderer.RenderHtmlAsPdf("<h1>Cover Page</h1><hr>"))
VB .NET

5.3. Remove the last page from the PDF

pdf.RemovePage((pdf.PageCount - 1))
VB .NET

5.4. Encrypt a PDF using 128 Bit Encryption

// Save with a strong encryption password.
pdf.Password = "my.secure.password";
pdf.SaveAs("secured.pdf")
VB .NET

5.5. Stamp Additional HTML Content Onto a Page in VB

Imports IronPdf
Imports IronPdf.Editing

Module Module1
    Sub Main()
        Dim renderer = New ChromePdfRenderer
        Dim pdf = renderer.RenderUrlAsPdf("https://www.nuget.org/packages/IronPdf")
        Dim stamp = New HtmlStamper()
        stamp.Html = "<h2>Completed</h2>"
        stamp.Opacity = 50
        stamp.Rotation = -45
        stamp.VerticalAlignment = VerticalAlignment.Top
        stamp.VerticalOffset = New Length(10)
        pdf.ApplyStamp(stamp)
        pdf.SaveAs("C:\Path\To\Stamped.pdf")
    End Sub
End Module
VB .NET

5.6. Add Page Break to PDF Using HTML

The easiest way to do this is with HTML and CSS:

<div style='page-break-after: always;'>&nbsp;</div>

6. More .NET PDF Tutorials

You may also be interested in:


Conclusion

In this tutorial, we discovered 6 ways to achieve VB.NET to PDF results using VB.NET as our programming language of choice.

  • HTML string to PDF
  • Creating a PDF in VB.NET using an HTML string to define its content
  • Rendering existing URLs as PDF files
  • Generating PDF from HTML files
  • HTML templating in VB.NET and conversion to dynamic PDFs
  • Converting ASP.NET pages with live data, such as ASPX to PDF files

For each, we used the popular IronPDF VB.NET library to allow us to turn HTML directly into PDF documents within .NET projects.


Tutorial Quick Access

Download this Tutorial as Source Code

The full free VB.NET HTML to PDF Source Code for this tutorial is available to download as a zipped Visual Studio project file.

Download

Explore this Tutorial on GitHub

You may also be interested in our extensive library of VB.NET PDF generation and manipulation examples on GitHub. Exploring source code is the fastest way to learn, and Github is the definitive way to do so online. I hope these examples help you get to grips with PDF related functionality in your VB projects.

Creating PDFS in ASP.NET with VB.NET and C# Source A Simple Hello World Project to Render HTML to PDF in VB.NET using IronPDF Exploring HTML To PDF in-depth with VB.NET

Download C# PDF Quickstart guide

To make developing PDFs in your .NET applications easier, we have compiled a quick-start guide as a PDF document. This "Cheat-Sheet" provides quick access to common functions and examples for generating and editing PDFs in C# and VB.NET - and will save time getting started using IronPDF in your .NET project.

Download

View the API Reference

Explore the API Reference for IronPDF, outlining the details of all of IronPDF's features, namespaces, classes, methods fields and enums.

View the API Reference

Frequently Asked Questions

What is IronPDF used for in VB.NET?

IronPDF is a library used to create and edit PDF files in VB.NET. It supports rendering HTML to PDFs, applying styles, and editing content, making it useful for a variety of .NET applications.

How can I install IronPDF in a VB.NET project?

You can install IronPDF in a VB.NET project via NuGet by searching for 'IronPDF' in the 'Manage NuGet Packages' dialog within Visual Studio. Alternatively, you can download the DLL and manually add it to your project.

Can IronPDF be used with .NET Core projects?

Yes, IronPDF is compatible with .NET Core as well as .NET Framework projects, starting from .NET Framework 4.6.2 and .NET Core 2.

What types of applications can integrate IronPDF?

IronPDF can be integrated into various application types including ASP.NET web apps, console applications, Windows Services, and desktop programs.

Is it possible to customize PDF document styles using IronPDF?

Yes, you can customize PDF styles using CSS and JavaScript. IronPDF supports styling in this manner, allowing for comprehensive customization of the PDF appearance.

Does IronPDF support merging multiple PDF files?

Yes, IronPDF allows you to merge multiple PDF files into a single document using its library functions.

Can I render a web page to a PDF using VB.NET and IronPDF?

Yes, IronPDF can render an entire web page to a PDF using its 'RenderUrlAsPdf' method in VB.NET.

What is the recommended method for generating dynamic PDFs in VB.NET?

Creating dynamic PDFs is best achieved by using HTML to define content and data bindings within your VB.NET application executed with IronPDF.

How do I apply a watermark to a PDF using IronPDF?

You can apply a watermark by stamping additional HTML content onto a page with IronPDF's editing capabilities.

Is IronPDF free to use for development purposes?

Yes, IronPDF offers unlimited free development, allowing you full access to its features prior to going live with your application.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...
Read More

Ready to Get Started?

Nuget Downloads 21,105,021Version:2026.9just released

Get your FREE

30-day Trial Key instantly.

bullet_checkedNo credit card or account creation required
bullet_testTest in production
without watermarks
bullet_calendar30 days fully
functional product
bullet_support24/5 technical
support during trial
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

OR
bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried Iron Suite
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required
C# NuGet Library for PDF
Install with NuGet

Version: 2026.9

PM > Install-Package IronPdf
nuget.org/packages/IronPdf/
  1. In Solution Explorer, right-click References, Manage NuGet Packages
  2. Select Browse and search "IronPdf"
  3. Select the package and install
C# PDF DLL
Download DLL

Version: 2026.9

or download Windows Installer here.

  1. Download and unzip IronPDF to a location such as ~/Libs within your Solution directory
  2. In Visual Studio Solution Explorer, right click References. Select Browse, "IronPdf.dll"

Licenses from $999