Multi Threaded Generation
IronPDF has extensive multithreading support using the 2021 Chrome Rendering API.
Approaches to threading in .NET include:
- System.Threading.Tasks (below)
- async/await
- Parallel.ForEach
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 Private renderer = New ChromePdfRenderer() Private htmlStrings = New List(Of String)() From {"<h1>Html#1</h1>", "<h1>Html#2</h1>", "<h1>Html#3</h1>"} Private task As Task(Of PdfDocument()) = System.Threading.Tasks.Task.WhenAll(htmlStrings.Select(Function(html) renderer.RenderHtmlAsPdfAsync(html))) Private pdfList As List(Of PdfDocument) = task.Result.ToList() ' Do something with the pdfDocuments
Install-Package IronPdf
IronPDF has extensive multithreading support using the 2021 Chrome Rendering API.
Approaches to threading in .NET include:
9 .NET API products for your office documents