IRONSOFTWAREHOME
Angular.JS to PDF
import {PdfDocument, WaitForType} from "@ironsoftware/ironpdf";

(async () => {
    // Configure render options
    const options = {
        enableJavaScript: true,
        // Wait for Javascript
        waitFor: {
            type: WaitForType.JavaScript,
            maxWaitTime: 500,
        },
    };
    
    const pdf = await PdfDocument.fromUrl("https://angular.io/", { renderOptions: options });

    // Export the PDF document
await pdf.saveAs("angular.pdf");
})();
npm i @ironsoftware/ironpdf
Angular.JS to PDF

Angular.JS to PDF

Utilize the fromUrl method to render a PDF document from a URL with IronPDF. Rendering occurs in an instance, which can sometimes lead to issues with loading JavaScript or fonts. To ensure that JavaScript and fonts load correctly, it is advisable to use the waitFor class and specify an appropriate wait type, as well as a maximum wait time.

The consequences of improperly loaded JavaScript or fonts may include:

  • Invisible text content
  • Incorrectly displayed content

Here is an example code snippet demonstrating how to render a PDF using IronPDF with proper waiting mechanisms:

Explanation of the Code

  • Import IronPDF Namespace: The code starts by importing the IronPdf and System namespaces. IronPDF is necessary for PDF rendering, and System provides basic functionalities such as using the TimeSpan class.
  • Main
  • Main Method: The Main method is the entry point of the program.
  • URL Specification: The variable url holds the URL of the web page that you wish to convert to a PDF document.
  • Initialize Renderer: An instance of the HtmlToPdf renderer is created using new HtmlToPdf(). This instance is used to perform the conversion.
  • Render URL to PDF: The RenderUrlAsPdf() method is called on the renderer instance to convert the URL's HTML content into a PDF document.
  • Ensure Full Page Load: To handle asynchronous loading of resources like JavaScript and fonts, WaitForNetworkIdle() is used. This method waits until network activity subsides, with a maximum wait time of TimeSpan.FromSeconds(10) specified. This is crucial for pages that heavily rely on dynamic content or fonts.
  • Save PDF: The resulting PDF is then saved to a file named output.pdf using the SaveAs() method.
  • Status Message: Finally, upon successful saving of the PDF, a confirmation message is printed to the console.

This approach ensures that the rendered PDF is complete and accurate, with all JavaScript and fonts properly loaded.

Explore Angular to PDF Conversion Code Example
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