IRONSOFTWAREHOME
Multi Threaded Generation
using IronPdf;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

// Instantiate Renderer
var renderer = new ChromePdfRenderer();

var htmlStrings = new List<string>() { "<h1>Html#1</h1>", "<h1>Html#2</h1>", "<h1>Html#3</h1>" };

Task<PdfDocument[]> task = Task.WhenAll(htmlStrings.Select(html => renderer.RenderHtmlAsPdfAsync(html)));

List<PdfDocument> pdfList = task.Result.ToList();

// Do something with the pdfDocuments
Imports IronPdf
Imports System.Collections.Generic
Imports System.Linq
Imports System.Threading.Tasks

' Instantiate Renderer
Dim renderer = New ChromePdfRenderer()

Dim htmlStrings = New List(Of String)() From {"<h1>Html#1</h1>", "<h1>Html#2</h1>", "<h1>Html#3</h1>"}

Dim task As Task(Of PdfDocument()) = Task.WhenAll(htmlStrings.Select(Function(html) renderer.RenderHtmlAsPdfAsync(html)))

Dim pdfList As List(Of PdfDocument) = task.Result.ToList()

' Do something with the pdfDocuments
NuGet Download
PM > Install-Package IronPdf
Multi Threaded Generation

Multi Threaded Generation

IronPDF provides thread-safe PDF generation and offers support for multi-threading processes when it comes to generating PDF documents with the ChromePdfRenderer class as seen in this example. This way, you can handle PDF generation tasks of any size, or batch PDF generation tasks, concurrently without the fear of running into issues such as thread blocking.

Steps to Multi-Threaded PDF Generation

The first step in generating PDF documents in a multi-threaded environment is to create a new ChromePdfRenderer instance. This gives us access to IronPDF's powerful rendering engine, capable of producing pixel-perfect PDF documents. Then, we will create a new List<string> of string objects, called htmlStrings. This list is full of the HTML strings that we will be generating PDF documents from in our Multi-Threaded environment.

Next, we need to use asynchronous programming to render all of our HTML strings to PDF files concurrently. htmlStrings.Select(html => renderer.RenderHtmlAsPdfAsync(html)) iterates over our list of HTML strings and calls the RenderHtmlAsPdfAsync method, accessed through the renderer, on each string found, converting them into PDF documents. Task.WhenAll() is used to accumulate the asynchronous tasks into a single task that will be completed once all of the individual RenderHtmlAsPdfAsync calls are finished. Then, it will return a new array of PdfDocument objects.

Finally, we will retrieve the results of our PDF generation. await task ensures that the current asynchronous method waits until all the asynchronous PDF rendering tasks are complete and retrieves the resulting array of PdfDocument objects. ToList() then converts the array of PdfDocument objects into the pdfList List for easier further manipulation of the PDF documents.

Explore Async PDF Rendering with IronPDF
View on GitHub

Ready to Get Started?

Nuget Downloads 20,990,528Version:2026.9just released

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 IronPDF
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