IRONSOFTWAREHOME
Multi Threaded Generation
import {PdfDocument} from "@ironsoftware/ironpdf";

(async () => {
    const htmlStrings = ["<h1>Html#1</h1>", "<h1>Html#2</h1>", "<h1>Html#3</h1>"];

    // Use Promise.all to render HTML strings asynchronously
    const renderPromises = htmlStrings.map(async (html) => {
        const pdf = await PdfDocument.fromHtml(html);
        // Perform more action to the returned PDF
        return pdf;
    });

    // Wait for all rendering Promises to complete
    const pdfDocuments = await Promise.all(renderPromises);
    
    // Do something with the pdfDocuments
})();
npm i @ironsoftware/ironpdf
Multi Threaded Generation

Multi Threaded Generation

JavaScript and Node.js both support asynchronous processing. So does IronPDF, a .NET PDF library, known for its efficient PDF generation and manipulation capabilities.

Most of IronPDF's methods return promises. Leveraging this, we can render multiple HTML contents, and then use the Promise.all method to wait until all the promises have finished.

Please note that the Promise.all method does not guarantee the success of all promises; it only ensures that the promises have finished.

The await within the .map function is used to wait for the returned PDF documents and perform further edits on the documents. If your goal is solely to render the PDFs without additional processing, the use of async and await may not be necessary.

Explore Asynchronous PDF Generation Code Examples
View on GitHub

Ready to Get Started?

Version:2026.8just 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 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
Node.js Module Download for PDF
Install with npm

Version: 2026.8

  1. Download and install Node.js 12+.
  2. Execute the above command in the terminal.

Licenses from $999